"Fossies" - the Fresh Open Source Software Archive

Member "fityk-1.3.1/doc/html/getstarted.html" (19 Dec 2016, 17750 Bytes) of package /linux/misc/fityk-1.3.1.tar.gz:

The requested HTML page contains a <FORM> tag that is unusable on "Fossies" in "automatic" (rendered) mode so that page is shown as HTML source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    2   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    5 <html xmlns="http://www.w3.org/1999/xhtml">
    6   <head>
    7     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    9     <title>Getting Started &#8212; Fityk 1.3.1 manual</title>
   11     <link rel="stylesheet" href="_static/fitheme.css" type="text/css" />
   12     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
   14     <script type="text/javascript">
   15       var DOCUMENTATION_OPTIONS = {
   16         URL_ROOT:    './',
   17         VERSION:     '1.3.1',
   18         COLLAPSE_INDEX: false,
   19         FILE_SUFFIX: '.html',
   20         HAS_SOURCE:  false,
   21         SOURCELINK_SUFFIX: '.txt'
   22       };
   23     </script>
   24     <script type="text/javascript" src="_static/jquery.js"></script>
   25     <script type="text/javascript" src="_static/underscore.js"></script>
   26     <script type="text/javascript" src="_static/doctools.js"></script>
   27     <link rel="shortcut icon" href="_static/fityk.ico"/>
   28     <link rel="search" title="Search" href="search.html" />
   29     <link rel="next" title="Data" href="data.html" />
   30     <link rel="prev" title="Introduction" href="intro.html" />
   32   <meta name="viewport" content="width=device-width, initial-scale=1">
   34   </head>
   35   <body role="document">  
   37     <div class="document">
   38       <div class="documentwrapper">
   39         <div class="bodywrapper">
   40           <div class="body" role="main">
   42   <div class="section" id="getting-started">
   43 <span id="getstarted"></span><h1>Getting Started<a class="headerlink" href="#getting-started" title="Permalink to this headline"></a></h1>
   44 <div class="section" id="graphical-interface">
   45 <h2>Graphical Interface<a class="headerlink" href="#graphical-interface" title="Permalink to this headline"></a></h2>
   46 <p>That&#8217;s how the <abbr title="Graphical User Interface">GUI</abbr> looks like:</p>
   47 <a class="reference internal image-reference" href="_images/fityk-with-tooltip.png"><img alt="_images/fityk-with-tooltip.png" class="align-center" src="_images/fityk-with-tooltip.png" style="width: 547.5px; height: 423.0px;" /></a>
   48 <p>The <strong>main plot</strong> can display data points, model that is to be fitted to the
   49 data and individual functions in the model. Use can configure what is displayed
   50 and how (through <span class="menuselection">GUI ‣ Configure</span> or context menu).</p>
   51 <p>The <strong>helper plot</strong> shows how well the model fits the data.
   52 You may have one, two or no helper plots (<span class="menuselection">GUI ‣ Show</span>).
   53 By default, the plot shows the difference between the data and the model.
   54 It can also show weighted or cumulative difference,
   55 and a couple of other things.</p>
   56 <p>The helper plot is also handy for zooming &#8211; with left and middle
   57 mouse buttons. Selecting a horizontal span with the left button
   58 zooms into this span. The middle button goes back to the whole dataset
   59 (the same as <img alt="Zoom All" class="icon" src="_images/zoom_all.png" /> in the toolbar).</p>
   60 <p>The <strong>sidebar</strong> is for switching between datasets, inspecting functions,
   61 and for changing function parameters. It also provides quick access
   62 to a few properties of the main plot, such as the size of data points.</p>
   63 <p>On the main plot, the meaning of the left and right mouse button depends
   64 on the current <strong>mouse mode</strong>. Mouse modes are switched using toolbar
   65 buttons:</p>
   66 <ul class="simple">
   67 <li><img alt="Normal Mode" class="icon" src="_images/mode_zoom.png" /> <em>normal mode</em> &#8211; the left button zooms in and
   68 the right button shows pop-up menu,</li>
   69 <li><img alt="Data-Range Mode" class="icon" src="_images/mode_range_icon.png" /> <em>data-range mode</em> &#8211; for activating and de-activating data,
   70 i.e. for selecting regions of interest,</li>
   71 <li><img alt="Baseline Mode" class="icon" src="_images/mode_bg_icon.png" /> <em>baseline mode</em> &#8211; manual baseline subtraction
   72 (in may never need it),</li>
   73 <li><img alt="Add-Peak Mode" class="icon" src="_images/mode_add_icon.png" /> <em>add-peak mode</em> &#8211; for placing peaks and other functions.</li>
   74 </ul>
   75 <p>The status bar shows a hint what the mouse does in the current mode.</p>
   76 <p>Finally, the <strong>input field</strong> and the <strong>output window</strong> provide alternative,
   77 console-like way of interacting with the program.
   78 Also, the GUI operations that change the state of the program
   79 (data, model, non-visual settings) are translated into textual commands
   80 and printed in the output window.</p>
   81 <div class="admonition note">
   82 <p class="first admonition-title">Note</p>
   83 <p class="last">To save configuration of the GUI (visible windows, colors, etc.)
   84 for next session use <span class="menuselection">GUI ‣ Save current config</span>.</p>
   85 </div>
   86 </div>
   87 <div class="section" id="minimal-example">
   88 <h2>Minimal Example<a class="headerlink" href="#minimal-example" title="Permalink to this headline"></a></h2>
   89 <p>Let us analyze a diffraction pattern of NaCl. Our goal is to determine
   90 the position of the center of the highest peak. It is needed for
   91 calculating the pressure under which the sample was measured, but this
   92 later detail in the processing is irrelevent for the time being.</p>
   93 <p>The data file used in this example is distributed with the program and
   94 can be found in the <code class="file docutils literal"><span class="pre">samples</span></code> directory.</p>
   95 <p>Textual commands that correspond to performed operations are shown
   96 in this section in <span class="cli-title">CLI</span> boxes.</p>
   97 <p>First load data from the <code class="file docutils literal"><span class="pre">nacl01.dat</span></code> file.
   98 Select <span class="menuselection">Data ‣ Load File</span>
   99 from the menu (or <img alt="Load Data" class="icon" src="_images/load_data_icon.png" /> from the toolbar) and choose the file.</p>
  100 <div class="admonition-cli admonition">
  101 <p class="first admonition-title">CLI</p>
  102 <p class="last">&#64;0 &lt; nacl01.dat</p>
  103 </div>
  104 <p>You can zoom-in to the biggest peak using the left mouse
  105 button on the residual (helper) plot.
  106 To zoom out, press <img alt="Zoom All" class="icon" src="_images/zoom_all.png" /> on the toolbar.</p>
  107 <p>Now all data points are active. Only the biggest peak is of
  108 our interest, so we want to deactivate the remaining points.
  109 Change to the <em>range mode</em> (toolbar: <img alt="Data-Range Mode" class="icon" src="_images/mode_range_icon.png" />)
  110 and deactivate not needed points with the right mouse button.</p>
  111 <div class="admonition-cli admonition">
  112 <p class="first admonition-title">CLI</p>
  113 <p class="last">A = (x &gt; 23.0 and x &lt; 26.0)</p>
  114 </div>
  115 <p>As our example data has no background to worry about, our next step is
  116 to define a peak with reasonable initial values and fit it to the data.
  117 We will use Gaussian.
  118 To see its formula, type: <code class="docutils literal"><span class="pre">info</span> <span class="pre">Gaussian</span></code> (or <code class="docutils literal"><span class="pre">i</span> <span class="pre">Gaussian</span></code>) or look for it
  119 in the section <a class="reference internal" href="model.html#flist"><span class="std std-ref">Built-In Functions</span></a>.</p>
  120 <p>Select <span class="guilabel">Gaussian</span> from the list of functions on the toolbar
  121 and press <img alt="Auto Add" class="icon" src="_images/add_peak_icon.png" />.</p>
  122 <div class="admonition-cli admonition">
  123 <p class="first admonition-title">CLI</p>
  124 <p class="last">guess Gaussian</p>
  125 </div>
  126 <p>Automatic peak detection works in this case, but if it wouldn&#8217;t, you may
  127 set the initial peak position, height and width manually.
  128 Either with mouse in the <em>add-peak mode</em>, or with a command.</p>
  129 <div class="admonition-cli admonition">
  130 <p class="first admonition-title">CLI</p>
  131 <p class="last">F += Gaussian(~60000, ~24.6, ~0.2)</p>
  132 </div>
  133 <p>Parameters of an existing function can be changed in the sideber,
  134 or by dragging that little square handle attached to each function
  135 (you should see a handle at the top of your Gaussian).</p>
  136 <p>If the peaks/functions are not named explicitely (like in this example),
  137 they get automatic names <code class="docutils literal"><span class="pre">%_1</span></code>, <code class="docutils literal"><span class="pre">%_2</span></code>, etc.</p>
  138 <p>Now let us fit the function.
  139 Select <span class="menuselection">Fit ‣ Run</span> from the menu or press <img alt="Fit" class="icon" src="_images/fit_icon.png" />.</p>
  140 <div class="admonition-cli admonition">
  141 <p class="first admonition-title">CLI</p>
  142 <p class="last">fit</p>
  143 </div>
  144 <div class="admonition important">
  145 <p class="first admonition-title">Important</p>
  146 <p class="last">Fitting minimizes the <strong>weighted</strong> sum of squared residuals
  147 (see <a class="reference internal" href="fit.html#nonlinear"><span class="std std-ref">Nonlinear Optimization</span></a>).
  148 The default <a class="reference internal" href="data.html#weights"><span class="std std-ref">weights of points</span></a> are not equal.</p>
  149 </div>
  150 <p>Now you can check the peak position together with other parameters
  151 on the sidebar.
  152 Alternatively, right click the peak handle
  153 and select <span class="menuselection">Show Info</span> from the context menu.</p>
  154 <div class="admonition-cli admonition">
  155 <p class="first admonition-title">CLI</p>
  156 <p class="last">info prop %_1</p>
  157 </div>
  158 <p>That&#8217;s it!</p>
  159 <p>By the way, you can save all the issued commands to a file
  160 (<span class="menuselection">Session ‣ Save History</span>)</p>
  161 <div class="admonition-cli admonition">
  162 <p class="first admonition-title">CLI</p>
  163 <p class="last">info history &gt; myscript.fit</p>
  164 </div>
  165 <p>and later use it as a macro (<span class="menuselection">Session ‣ Execute script</span>).</p>
  166 <div class="admonition-cli admonition">
  167 <p class="first admonition-title">CLI</p>
  168 <p class="last">exec myscript.fit</p>
  169 </div>
  170 </div>
  171 <div class="section" id="command-line">
  172 <span id="cli"></span><h2>Command Line<a class="headerlink" href="#command-line" title="Permalink to this headline"></a></h2>
  173 <p>Fityk comes with a small domain-specific language (DSL).
  174 All operations in Fityk are driven by commands of this language.
  175 Commands can be typed in the input box in the GUI, but if all you want
  176 to do is to type commands, the program has a separate CLI version (cfityk)
  177 for this.</p>
  178 <div class="admonition-do-not-worry admonition">
  179 <p class="first admonition-title">Do not worry</p>
  180 <p class="last">you do not need to learn these commands.
  181 It is possible to use menus and dialogs in the GUI
  182 and completely avoid typing commands.</p>
  183 </div>
  184 <p>When you use the GUI and perform an action using the menu,
  185 you can see the corresponding command in the output window.
  186 Fityk has less than 30 commands. Each performs a single actions,
  187 such as loading data from file, adding function, assigning variable,
  188 fitting, or writing results to a file.</p>
  189 <p>A sequence of commands written down in a file makes a script (macro),
  190 which can automate common tasks. Complex tasks may need to be programmed
  191 in a general-purpose language. That is why Fityk has embedded Lua interpreter
  192 (Lua is a lightweight programming language).
  193 It is also possible to use Fityk library from a program in Python, C, C++,
  194 Java, Ruby or Perl, and possibly from other languages supported by SWIG.</p>
  195 <p>Now a quick glimpse at the syntax. The <code class="docutils literal"><span class="pre">=-&gt;</span></code> prompt below marks an input:</p>
  196 <div class="highlight-fityk"><div class="highlight"><pre><span></span><span class="gp">=-&gt; </span>print pi
  197 3.14159
  198 <span class="gp">=-&gt; </span><span class="c"># this is a comment -- from `#&#39; to the end of line</span>
  199 <span class="gp">=-&gt; </span>p <span class="s1">&#39;2+3=&#39;</span>, 2+3  <span class="c"># p stands for print</span>
  200 2+3 = 5
  201 <span class="gp">=-&gt; </span>set numeric_format=<span class="s1">&#39;%.9f&#39;</span>  <span class="c"># show 9 digits after dot</span>
  202 <span class="gp">=-&gt; </span>pr pi, pi^2, pi^3  <span class="c"># pr, pri and prin also stand for print</span>
  203 3.141592654 9.869604401 31.006276680
  204 </pre></div>
  205 </div>
  206 <p>Usually, one line has one command, but if it is really needed,
  207 two or more commands can be put in one line:</p>
  208 <div class="highlight-fityk"><div class="highlight"><pre><span></span><span class="gp">=-&gt; </span>$a = 3; $b = 5  <span class="c"># two commands separated with `;&#39;</span>
  209 </pre></div>
  210 </div>
  211 <p>or a backslash can be used to continue a command in the next line:</p>
  212 <div class="highlight-fityk"><div class="highlight"><pre><span></span><span class="gp">=-&gt; </span>print \
  213 ... <span class="s1">&#39;this&#39;</span>
  214 this
  215 </pre></div>
  216 </div>
  217 <p>If the user works simultaneously with multiple datasets, she can refer to
  218 a dataset using its number: the first dataset is <code class="docutils literal"><span class="pre">&#64;0</span></code>, the second &#8211; <code class="docutils literal"><span class="pre">&#64;1</span></code>,
  219 etc:</p>
  220 <div class="highlight-fityk"><div class="highlight"><pre><span></span><span class="gp">=-&gt; </span>fit <span class="c"># perform fitting of the default dataset (the first one)</span>
  221 <span class="gp">=-&gt; </span>@2: fit <span class="c"># fit the third dataset (@2)</span>
  222 <span class="gp">=-&gt; </span>@2 @3: fit <span class="c"># fit the third dataset (@2) and then the fourth one (@3)</span>
  223 <span class="gp">=-&gt; </span>@*: fit <span class="c"># fit all datasets, one by one</span>
  224 </pre></div>
  225 </div>
  226 <p>Settings in the program are changed with the command <code class="docutils literal"><span class="pre">set</span></code>:</p>
  227 <div class="highlight-fityk"><div class="highlight"><pre><span></span>set key = value
  228 </pre></div>
  229 </div>
  230 <p>For example:</p>
  231 <div class="highlight-fityk"><div class="highlight"><pre><span></span><span class="gp">=-&gt; </span>set logfile = <span class="s1">&#39;C:\log.fit&#39;</span> <span class="c"># log all commands to this file</span>
  232 <span class="gp">=-&gt; </span>set verbosity = 1 <span class="c"># make output from the program more verbose</span>
  233 <span class="gp">=-&gt; </span>set epsilon = 1e-14
  234 </pre></div>
  235 </div>
  236 <p>The last example changes the <em>ε</em> value, which is used to test floating-point
  237 numbers <em>a</em> and <em>b</em> for equality (it is well known that due to rounding
  238 errors the equality test for two numbers should have some tolerance,
  239 and the tolerance should be tailored to the application): |<em>a−b</em>| &lt; <em>ε</em>.</p>
  240 <p>To run a single command with different settings, add <code class="docutils literal"><span class="pre">with</span> <span class="pre">key=value</span></code> before
  241 the command:</p>
  242 <div class="highlight-fityk"><div class="highlight"><pre><span></span><span class="gp">=-&gt; </span>print pi == 3.14  <span class="c"># default epsilon = 10^-12</span>
  243 0
  244 <span class="gp">=-&gt; </span>with epsilon = 0.1 print pi == 3.14  <span class="c"># abusing epsilon</span>
  245 1
  246 </pre></div>
  247 </div>
  248 <p>Putting it all together, a line typically has a single command,
  249 often prefixed with datasets+<code class="docutils literal"><span class="pre">:</span></code>, sometimes prefixed with <code class="docutils literal"><span class="pre">with</span></code>.
  250 In general it is:</p>
  251 <div class="highlight-none"><div class="highlight"><pre><span></span>[[@...:] [with ...] command [&quot;;&quot; command]...] [#comment]
  252 </pre></div>
  253 </div>
  254 <p>All the commands are described in next chapters.</p>
  255 </div>
  256 </div>
  259           </div>
  260         </div>
  261       </div>
  262       <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  263         <div class="sphinxsidebarwrapper">
  264 <p class="logo">
  265  <a href="http://fityk.nieto.pl/">
  266   <img class="logo" src="_static/fityk-logo.png" alt="Logo"/>
  267  </a>
  268 <br/ >curve fitting,&nbsp; data analysis
  270 </p>
  272 <h3><a href="fityk-manual.html">Manual</a></h3>
  273 <ul class="current">
  274 <li class="toctree-l1"><a class="reference internal" href="intro.html">Introduction</a></li>
  275 <li class="toctree-l1 current"><a class="current reference internal" href="#">Getting Started</a><ul>
  276 <li class="toctree-l2"><a class="reference internal" href="#graphical-interface">Graphical Interface</a></li>
  277 <li class="toctree-l2"><a class="reference internal" href="#minimal-example">Minimal Example</a></li>
  278 <li class="toctree-l2"><a class="reference internal" href="#command-line">Command Line</a></li>
  279 </ul>
  280 </li>
  281 <li class="toctree-l1"><a class="reference internal" href="data.html">Data</a></li>
  282 <li class="toctree-l1"><a class="reference internal" href="model.html">Models</a></li>
  283 <li class="toctree-l1"><a class="reference internal" href="fit.html">Curve Fitting</a></li>
  284 <li class="toctree-l1"><a class="reference internal" href="script.html">Scripts</a></li>
  285 <li class="toctree-l1"><a class="reference internal" href="ref.html">All the Rest</a></li>
  286 </ul>
  288 <ul>
  289  <li class="toctree-l1">
  290  <a class="reference external" href="https://github.com/wojdyr/fityk/wiki">Wiki</a>
  291  </li>
  292 </ul>
  293 <div id="searchbox" role="search">
  294     <form class="search" action="search.html" method="get">
  295       <input type="text" name="q" size="12" />
  296       <input type="submit" value="Search" />
  297       <input type="hidden" name="check_keywords" value="yes" />
  298       <input type="hidden" name="area" value="default" />
  299     </form>
  300 </div>
  301         </div>
  302       </div>
  303       <div class="clearer"></div>
  304     </div>
  305    <div class="related" role="navigation" aria-label="related navigation">
  306     Next: <a href="data.html">Data</a>
  307    </div>
  309   <div class="footer" role="contentinfo">
  310     Updated on 2016-12-19 with Sphinx 1.5.1.
  311         | <a href="https://github.com/wojdyr/fityk/blob/master/doc/getstarted.rst"
  312           rel="nofollow">Edit on GitHub</a>
  313   </div>
  314   </body>
  315 </html>