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>
