/usr/share/doc/python-versuchung/html/intro.html is in python-versuchung 1.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Quick Introduction — versuchung 0.1-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: '0.1-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>
<link rel="top" title="versuchung 0.1-0 documentation" href="index.html" />
<link rel="next" title="Defining a Experiment" href="experiment/index.html" />
<link rel="prev" title="Versuchung - a toolbox for experiments" href="index.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="experiment/index.html" title="Defining a Experiment"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="index.html" title="Versuchung - a toolbox for experiments"
accesskey="P">previous</a> |</li>
<li><a href="index.html">versuchung 0.1-0 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="quick-introduction">
<h1>Quick Introduction<a class="headerlink" href="#quick-introduction" title="Permalink to this headline">ΒΆ</a></h1>
<p>As a quick start a simple experiment with input and output parameters is show:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c">#!/usr/bin/python</span>
<span class="kn">from</span> <span class="nn">versuchung.experiment</span> <span class="kn">import</span> <span class="n">Experiment</span>
<span class="kn">from</span> <span class="nn">versuchung.types</span> <span class="kn">import</span> <span class="n">String</span>
<span class="kn">from</span> <span class="nn">versuchung.files</span> <span class="kn">import</span> <span class="n">File</span>
<span class="k">class</span> <span class="nc">SimpleExperiment</span><span class="p">(</span><span class="n">Experiment</span><span class="p">):</span>
<span class="n">inputs</span> <span class="o">=</span> <span class="p">{</span><span class="s">"input_key"</span><span class="p">:</span> <span class="n">String</span><span class="p">(</span><span class="s">"default key"</span><span class="p">),</span>
<span class="s">"input_value"</span><span class="p">:</span> <span class="n">String</span><span class="p">(</span><span class="s">"default value"</span><span class="p">)}</span>
<span class="n">outputs</span> <span class="o">=</span> <span class="p">{</span><span class="s">"output_file"</span><span class="p">:</span> <span class="n">File</span><span class="p">(</span><span class="s">"output"</span><span class="p">)}</span>
<span class="k">def</span> <span class="nf">run</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="c"># Combine the input parameters</span>
<span class="n">content</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">inputs</span><span class="o">.</span><span class="n">input_key</span><span class="o">.</span><span class="n">value</span> \
<span class="o">+</span> <span class="s">": "</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">inputs</span><span class="o">.</span><span class="n">input_value</span><span class="o">.</span><span class="n">value</span>
<span class="c"># write the result to the output file</span>
<span class="bp">self</span><span class="o">.</span><span class="n">outputs</span><span class="o">.</span><span class="n">output_file</span><span class="o">.</span><span class="n">value</span> <span class="o">=</span> <span class="n">content</span> <span class="o">+</span> <span class="s">"</span><span class="se">\n</span><span class="s">"</span>
<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">"__main__"</span><span class="p">:</span>
<span class="kn">import</span> <span class="nn">sys</span>
<span class="n">experiment</span> <span class="o">=</span> <span class="n">SimpleExperiment</span><span class="p">()</span>
<span class="n">dirname</span> <span class="o">=</span> <span class="n">experiment</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">)</span>
<span class="k">print</span> <span class="n">dirname</span>
</pre></div>
</div>
<p>This experiment is put in a single python script file. It is a
complete experiment and a runnable python script with a command line
parser to override the default experiment input parameters.</p>
<p>Every experiment inherits from the
<a class="reference internal" href="experiment/index.html#versuchung.experiment.Experiment" title="versuchung.experiment.Experiment"><tt class="xref py py-class docutils literal"><span class="pre">Experiment</span></tt></a> class to gain the basic
structure for parameter handling and running the experiment. After
that the member variable
<a class="reference internal" href="experiment/index.html#versuchung.experiment.Experiment.inputs" title="versuchung.experiment.Experiment.inputs"><tt class="xref py py-attr docutils literal"><span class="pre">inputs</span></tt></a> defines a
<tt class="xref py py-class docutils literal"><span class="pre">dict</span></tt> of the input parameters. In this case two such input
parameters are defined <tt class="docutils literal"><span class="pre">"input_key"</span></tt> and <tt class="docutils literal"><span class="pre">"input_value"</span></tt>, which
are both of type <a class="reference internal" href="types/basic_types.html#versuchung.types.String" title="versuchung.types.String"><tt class="xref py py-class docutils literal"><span class="pre">String</span></tt></a> and have a
specified default value. This default value is used if no argument is
given on the command line. The attribute
<a class="reference internal" href="experiment/index.html#versuchung.experiment.Experiment.outputs" title="versuchung.experiment.Experiment.outputs"><tt class="xref py py-attr docutils literal"><span class="pre">outputs</span></tt></a> defines the
output parameter <tt class="docutils literal"><span class="pre">"output_file"</span></tt> which is of type
<a class="reference internal" href="types/filesystem.html#versuchung.files.File" title="versuchung.files.File"><tt class="xref py py-class docutils literal"><span class="pre">File</span></tt></a> with the filename <tt class="docutils literal"><span class="pre">"output"</span></tt>. So
in the experiment output there will be a file called <em>output</em>.</p>
<p>The <a class="reference internal" href="experiment/index.html#versuchung.experiment.Experiment.run" title="versuchung.experiment.Experiment.run"><tt class="xref py py-meth docutils literal"><span class="pre">run()</span></tt></a> method is the
heart of every experiment. It is called when all input parameters are
gathered and the experiment environment is set up. In this
<tt class="docutils literal"><span class="pre">SimpleExperiment</span></tt> the input parameters are simply concatenated and
written to the output file. This <tt class="docutils literal"><span class="pre">SimpleExperiment</span></tt> can be
instantiated without arguments. The resulting object is called with
the command line parameters to enable a command line interface.</p>
<p>Calling <tt class="docutils literal"><span class="pre">python</span> <span class="pre">experiment.py</span> <span class="pre">--help</span></tt> gives:</p>
<div class="highlight-python"><div class="highlight"><pre>Usage: experiment.py <options>
Options:
-h, --help show this help message and exit
-d BASE_DIR, --base-dir=BASE_DIR
Directory which is used for storing the experiment
data
-l, --list list all experiment results
-v, --verbose increase verbosity (specify multiple times for more)
--input_key=INPUT_KEY
(default: default key)
--input_value=INPUT_VALUE
(default: default value)
</pre></div>
</div>
<p>As you can see the two input parameters can be overwritten on the
command line. The experiment can be executed by <tt class="docutils literal"><span class="pre">python</span>
<span class="pre">experiment.py</span></tt> and print on the console:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">SimpleExperiment</span><span class="o">-</span><span class="n">aeb298601cdc582b1b0d8260195f6cfd</span>
</pre></div>
</div>
<p>This is the versioned experiment result set. The hash at the end is
calculated from the metadata of the experiment (e.g. input parameter
values and the experiment version). In the current directory there was
a directory created with this name where the results are located. To
examine the experiment results and their metadata <tt class="docutils literal"><span class="pre">python</span>
<span class="pre">experiment.py</span> <span class="pre">-l</span></tt> can be called:</p>
<div class="highlight-python"><div class="highlight"><pre>+SimpleExperiment-aeb298601cdc582b1b0d8260195f6cfd
| {'date': '2012-01-14 09:46:13.445703',
| 'experiment-name': 'SimpleExperiment',
| 'experiment-version': 1,
| 'input_key': 'default key',
| 'input_value': 'default value'}
</pre></div>
</div>
<p>As you can see there is one result set in the current directory. All
key parameters for the experiment are stored within the <tt class="docutils literal"><span class="pre">metadata</span></tt>
file in the result directory. The <tt class="docutils literal"><span class="pre">output</span></tt> file in this result
directory contains:</p>
<div class="highlight-python"><div class="highlight"><pre>default key: default value
</pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="index.html"
title="previous chapter">Versuchung - a toolbox for experiments</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="experiment/index.html"
title="next chapter">Defining a Experiment</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/intro.txt"
rel="nofollow">Show Source</a></li>
</ul>
<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 class="right" >
<a href="experiment/index.html" title="Defining a Experiment"
>next</a> |</li>
<li class="right" >
<a href="index.html" title="Versuchung - a toolbox for experiments"
>previous</a> |</li>
<li><a href="index.html">versuchung 0.1-0 documentation</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2012-2014, Christian Dietrich.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
</div>
</body>
</html>
|