<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>functions module &mdash; binary_c-python  documentation</title>
      <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
      <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <!--[if lt IE 9]>
    <script src="_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
        <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
        <script src="_static/jquery.js"></script>
        <script src="_static/underscore.js"></script>
        <script src="_static/doctools.js"></script>
        <script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
    <script src="_static/js/theme.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="Population class module" href="grid.html" />
    <link rel="prev" title="ensemble module" href="ensemble.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
            <a href="index.html" class="icon icon-home"> binary_c-python
          </a>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="readme_link.html">Python module for binary_c</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="modules.html">Binarycpython code</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="custom_logging_functions.html">custom_logging_functions module</a></li>
<li class="toctree-l2"><a class="reference internal" href="dicts.html">dicts module</a></li>
<li class="toctree-l2"><a class="reference internal" href="ensemble.html">ensemble module</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">functions module</a></li>
<li class="toctree-l2"><a class="reference internal" href="grid.html">Population class module</a></li>
<li class="toctree-l2"><a class="reference internal" href="plot_functions.html">plot_functions module</a></li>
<li class="toctree-l2"><a class="reference internal" href="population_extensions/analytics.html">Population class extension: analytics module</a></li>
<li class="toctree-l2"><a class="reference internal" href="population_extensions/cache.html">Population class extension: cache module</a></li>
<li class="toctree-l2"><a class="reference internal" href="population_extensions/condor.html">Population class extension: condor module</a></li>
<li class="toctree-l2"><a class="reference internal" href="population_extensions/dataIO.html">Population class extension: dataIO module</a></li>
<li class="toctree-l2"><a class="reference internal" href="population_extensions/distribution_functions.html">Population class extension: distribution_functions module</a></li>
<li class="toctree-l2"><a class="reference internal" href="population_extensions/gridcode.html">Population class extension: gridcode module</a></li>
<li class="toctree-l2"><a class="reference internal" href="population_extensions/grid_logging.html">Population class extension: grid_logging module</a></li>
<li class="toctree-l2"><a class="reference internal" href="population_extensions/grid_options_defaults.html">Population class extension: grid_options_defaults module</a></li>
<li class="toctree-l2"><a class="reference internal" href="population_extensions/HPC.html">Population class extension: HPC module</a></li>
<li class="toctree-l2"><a class="reference internal" href="population_extensions/metadata.html">Population class extension: metadata module</a></li>
<li class="toctree-l2"><a class="reference internal" href="population_extensions/Moe_di_Stefano_2017.html">Population class extension: Moe_di_Stefano_2017 module</a></li>
<li class="toctree-l2"><a class="reference internal" href="population_extensions/slurm.html">Population class extension: slurm module</a></li>
<li class="toctree-l2"><a class="reference internal" href="population_extensions/spacing_functions.html">Population class extension: spacing_functions module</a></li>
<li class="toctree-l2"><a class="reference internal" href="population_extensions/version_info.html">Population class extension: version_info module</a></li>
<li class="toctree-l2"><a class="reference internal" href="run_system_wrapper.html">run_system_wrapper module</a></li>
<li class="toctree-l2"><a class="reference internal" href="stellar_types.html">stellar_types module</a></li>
<li class="toctree-l2"><a class="reference internal" href="useful_funcs.html">useful_funcs module</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="example_notebooks.html">Example notebooks</a></li>
<li class="toctree-l1"><a class="reference internal" href="binary_c_parameters.html">Binary_c parameters</a></li>
<li class="toctree-l1"><a class="reference internal" href="grid_options_descriptions.html">Population grid code options</a></li>
<li class="toctree-l1"><a class="reference external" href="https://gitlab.eps.surrey.ac.uk/ri0005/binary_c-python">Visit the GitLab repo</a></li>
<li class="toctree-l1"><a class="reference external" href="https://gitlab.eps.surrey.ac.uk/ri0005/binary_c-python/-/issues/new">Submit an issue</a></li>
</ul>

        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">binary_c-python</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
          <li><a href="modules.html">Binarycpython code</a> &raquo;</li>
      <li>functions module</li>
      <li class="wy-breadcrumbs-aside">
            <a href="_sources/functions.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  
<style>
/* CSS overrides for sphinx_rtd_theme */

/* 24px margin */
.nbinput.nblast.container,
.nboutput.nblast.container {
    margin-bottom: 19px;  /* padding has already 5px */
}

/* ... except between code cells! */
.nblast.container + .nbinput.container {
    margin-top: -19px;
}

.admonition > p:before {
    margin-right: 4px;  /* make room for the exclamation icon */
}

/* Fix math alignment, see https://github.com/rtfd/sphinx_rtd_theme/pull/686 */
.math {
    text-align: unset;
}
</style>
<section id="module-binarycpython.utils.functions">
<span id="functions-module"></span><h1>functions module<a class="headerlink" href="#module-binarycpython.utils.functions" title="Permalink to this headline"></a></h1>
<p>Module containing most of the utility functions for the binarycpython package</p>
<p>Functions here are mostly functions used in other classes/functions, or
useful functions for the user</p>
<dl class="simple">
<dt>Tasks:</dt><dd><ul class="simple">
<li><p>TODO: change all prints to verbose_prints</p></li>
</ul>
</dd>
</dl>
<dl class="py class">
<dt class="sig sig-object py" id="binarycpython.utils.functions.Capturing">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">Capturing</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">iterable</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">()</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">/</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#Capturing"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.Capturing" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></p>
<p>Context manager to capture output and store it</p>
<dl class="py method">
<dt class="sig sig-object py" id="binarycpython.utils.functions.Capturing.__enter__">
<span class="sig-name descname"><span class="pre">__enter__</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#Capturing.__enter__"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.Capturing.__enter__" title="Permalink to this definition"></a></dt>
<dd><p>On entry we capture the stdout output</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="binarycpython.utils.functions.Capturing.__exit__">
<span class="sig-name descname"><span class="pre">__exit__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#Capturing.__exit__"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.Capturing.__exit__" title="Permalink to this definition"></a></dt>
<dd><p>On exit we release the capture again</p>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.bin_data">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">bin_data</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">binwidth</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#bin_data"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.bin_data" title="Permalink to this definition"></a></dt>
<dd><p>Function that bins the data using the absolute value of binwidth using the following formula:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">((</span><span class="mf">0.5</span> <span class="k">if</span> <span class="n">value</span> <span class="o">&gt;</span> <span class="mf">0.0</span> <span class="k">else</span> <span class="o">-</span><span class="mf">0.5</span><span class="p">)</span> <span class="o">+</span> <span class="nb">int</span><span class="p">(</span><span class="n">value</span> <span class="o">/</span> <span class="nb">abs</span><span class="p">(</span><span class="n">binwidth</span><span class="p">)))</span> <span class="o">*</span> <span class="nb">abs</span><span class="p">(</span><span class="n">binwidth</span><span class="p">)</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>value</strong> – value that we want to bin</p></li>
<li><p><strong>binwidth</strong> – width of the binning</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>binned value</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.call_binary_c_config">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">call_binary_c_config</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">argument</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#call_binary_c_config"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.call_binary_c_config" title="Permalink to this definition"></a></dt>
<dd><p>Function to interface with the binary_c config file</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>argument</strong> – argument for the binary_c config</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>raw output of binary_c-config</p>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="binarycpython.utils.functions.catchtime">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">catchtime</span></span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#catchtime"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.catchtime" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Context manager to calculate time spent</p>
<dl class="py method">
<dt class="sig sig-object py" id="binarycpython.utils.functions.catchtime.__enter__">
<span class="sig-name descname"><span class="pre">__enter__</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#catchtime.__enter__"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.catchtime.__enter__" title="Permalink to this definition"></a></dt>
<dd><p>On entry we start the clock</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="binarycpython.utils.functions.catchtime.__exit__">
<span class="sig-name descname"><span class="pre">__exit__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">exc_type</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">exc_val</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">exc_tb</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#catchtime.__exit__"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.catchtime.__exit__" title="Permalink to this definition"></a></dt>
<dd><p>On exit we stop the clock and measure the time spent</p>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.check_if_in_shell">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">check_if_in_shell</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#check_if_in_shell"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.check_if_in_shell" title="Permalink to this definition"></a></dt>
<dd><p>Function to check whether the script is running from a shell</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.conv_time_units">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">conv_time_units</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">t</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#conv_time_units"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.conv_time_units" title="Permalink to this definition"></a></dt>
<dd><p>Converts time (t, in seconds, passing in as the only argument) to seconds, minutes or hours depending on its magnitude. Returns a tuple (t,units).</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.convert_bytes">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">convert_bytes</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">size</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#convert_bytes"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.convert_bytes" title="Permalink to this definition"></a></dt>
<dd><p>Function to return the size + a magnitude string</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.convfloat">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">convfloat</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#convfloat"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.convfloat" title="Permalink to this definition"></a></dt>
<dd><p>Convert scalar x to a float if we can, in which case return the float, otherwise just return x without changing it. Usually, x is a string, but could be anything that float() can handle without failure.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.create_arg_string">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">create_arg_string</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">arg_dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sort</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">filter_values</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#create_arg_string"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.create_arg_string" title="Permalink to this definition"></a></dt>
<dd><p>Function that creates the arg string for binary_c. Takes a dictionary containing the arguments
and writes them to a string
This string is missing the ‘binary_c ‘ at the start.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>arg_dict</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code>) – dictionary</p></li>
<li><p><strong>sort</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – (optional, default = False) Boolean whether to sort the order of the keys.</p></li>
<li><p><strong>filter_values</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – (optional, default = False) filters the input dict on keys that have NULL or <cite>function</cite> as value.</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The string built up by combining all the key + value’s.</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.create_hdf5">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">create_hdf5</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data_dir</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#create_hdf5"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.create_hdf5" title="Permalink to this definition"></a></dt>
<dd><dl class="simple">
<dt>Function to create an hdf5 file from the contents of a directory:</dt><dd><ul class="simple">
<li><p>settings file is selected by checking on files ending on settings</p></li>
<li><p>data files are selected by checking on files ending with .dat</p></li>
</ul>
</dd>
</dl>
<p>TODO: fix missing settings files</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data_dir</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – directory containing the data files and settings file</p></li>
<li><p><strong>name</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – name of hdf5file.</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.datalinedict">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">datalinedict</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">line</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">parameters</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#datalinedict"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.datalinedict" title="Permalink to this definition"></a></dt>
<dd><p>Convert a line of data to a more convenient dictionary.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>string</strong> (<em>line = a line of data as a</em>) – </p></li>
<li><p><strong>names</strong> (<em>parameters = a list of the parameter</em>) – </p></li>
</ul>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>If the parameter is a floating point number, it will be converted to Python’s float type.</p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.example_parse_output">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">example_parse_output</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">selected_header</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#example_parse_output"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.example_parse_output" title="Permalink to this definition"></a></dt>
<dd><p>Function that parses output of binary_c. This version serves as an example and is quite
detailed. Custom functions can be easier:</p>
<p>This function works in two cases:
if the caught line contains output like ‘example_header time=12.32 mass=0.94 ..’
or if the line contains output like ‘example_header 12.32 0.94’
Please don’t the two cases.</p>
<p>You can give a ‘selected_header’ to catch any line that starts with that.
Then the values will be put into a dictionary.</p>
<dl class="simple">
<dt>Tasks:</dt><dd><ul class="simple">
<li><p>TODO: Think about exporting to numpy array or pandas instead of a defaultdict</p></li>
<li><p>TODO: rethink whether this function is necessary at all</p></li>
<li><p>TODO: check this function again</p></li>
</ul>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>output</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – binary_c output string</p></li>
<li><p><strong>selected_header</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – string header of the output (the start of the line that you want to
process)</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>dictionary containing parameters as keys and lists for the values</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.filter_arg_dict">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">filter_arg_dict</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">arg_dict</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#filter_arg_dict"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.filter_arg_dict" title="Permalink to this definition"></a></dt>
<dd><p>Function to filter out keys that contain values included in [‘NULL’, ‘Function’, ‘’]</p>
<p>This function is called by get_defaults()</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>arg_dict</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code>) – dictionary containing the argument + default key pairs of binary_c</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>filtered dictionary (pairs with NULL and Function values are removed)</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.format_number">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">format_number</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">number</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#format_number"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.format_number" title="Permalink to this definition"></a></dt>
<dd><p>Function to take a number, express format it in scientific notation, and remove the trailing 0 if the exponent is 0</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.get_ANSI_colours">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">get_ANSI_colours</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#get_ANSI_colours"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.get_ANSI_colours" title="Permalink to this definition"></a></dt>
<dd><p>Function that returns a dictionary with text-colors in ANSI formatting</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.get_arg_keys">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">get_arg_keys</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#get_arg_keys"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.get_arg_keys" title="Permalink to this definition"></a></dt>
<dd><p>Function that return the list of possible keys to give in the arg string.
This function calls get_defaults()</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>list of all the parameters that binary_c accepts (and has default values for, since
we call get_defaults())</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.get_defaults">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">get_defaults</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">filter_values</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#get_defaults"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.get_defaults" title="Permalink to this definition"></a></dt>
<dd><p>Function that calls the binaryc get args function and cast it into a dictionary.</p>
<p>All the values are strings</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>filter_values</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – whether to filter out NULL and Function defaults.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>dictionary containing the parameter name as key and the parameter default as value</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.get_help">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">get_help</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">param_name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">print_help</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fail_silently</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#get_help"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.get_help" title="Permalink to this definition"></a></dt>
<dd><p>Function that returns the help info for a given parameter, by interfacing with binary_c</p>
<p>Will check whether it is a valid parameter.</p>
<p>Binary_c will output things in the following order:
- Did you mean?
- binary_c help for variable
- default
- available macros</p>
<p>This function reads out that structure and catches the different components of this output</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>param_name</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – name of the parameter that you want info from. Will get checked whether its a
valid parameter name</p></li>
<li><p><strong>print_help</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – (optional, default = True) whether to print out the help information</p></li>
<li><p><strong>fail_silently</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – (optional, default = False) Whether to print the errors raised if the</p></li>
<li><p><strong>valid</strong> (<em>parameter isn't</em>) – </p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code>]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Dictionary containing the help info. This dictionary contains <cite>parameter_name</cite>,
<cite>parameter_value_input_type</cite>, <cite>description</cite>, optionally <cite>macros</cite></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.get_help_all">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">get_help_all</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">print_help</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#get_help_all"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.get_help_all" title="Permalink to this definition"></a></dt>
<dd><p>Function that reads out the output of the return_help_all API call to binary_c. This return_help_all binary_c returns all the information for the parameters, their descriptions and other properties. The output is categorised in sections.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>print_help</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – (optional, default = True) prints all the parameters and their descriptions.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>returns a dictionary containing dictionaries per section. These dictionaries contain the parameters and descriptions etc for all the parameters in that section</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.get_help_super">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">get_help_super</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">print_help</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fail_silently</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#get_help_super"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.get_help_super" title="Permalink to this definition"></a></dt>
<dd><p>Function that first runs get_help_all, and then per argument also run
the help function to get as much information as possible.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>print_help</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – (optional, default = False) Whether to print the information</p></li>
<li><p><strong>fail_silently</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – (optional, default = True) Whether to fail silently or to print the errors</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>dictionary containing all dictionaries per section, which then contain as much info as possible per parameter.</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.get_size">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">get_size</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">obj</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">seen</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#get_size"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.get_size" title="Permalink to this definition"></a></dt>
<dd><p>Recursively finds size of objects</p>
<p>From <a class="reference external" href="https://github.com/bosswissam/pysize">https://github.com/bosswissam/pysize</a></p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.get_username">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">get_username</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#get_username"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.get_username" title="Permalink to this definition"></a></dt>
<dd><p>Function to get the username of the user that spawned the current process</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.imports">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">imports</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#imports"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.imports" title="Permalink to this definition"></a></dt>
<dd><p>Generator that generates the names of all the modules that are loaded in the globals</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.is_capsule">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">is_capsule</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">o</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#is_capsule"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.is_capsule" title="Permalink to this definition"></a></dt>
<dd><p>Function to tell whether object is a capsule</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.isfloat">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">isfloat</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#isfloat"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.isfloat" title="Permalink to this definition"></a></dt>
<dd><p>Function to return <cite>True</cite> if the “number” x, which could be a string, is an float, otherwise return <cite>False</cite>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>x</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>]) – string float or int that we will attempt to convert to an <cite>float</cite> value.</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.isint">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">isint</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#isint"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.isint" title="Permalink to this definition"></a></dt>
<dd><p>Function to return <cite>True</cite> if the “number” x, which could be a string, is an int, otherwise return <cite>False</cite>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>x</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>]) – string float or int that we will attempt to convert to an <cite>int</cite> value.</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.load_logfile">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">load_logfile</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">logfile</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#load_logfile"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.load_logfile" title="Permalink to this definition"></a></dt>
<dd><p>Experimental function that parses the generated log file of binary_c.</p>
<p>This function is not finished and shouldn’t be used yet.</p>
<dl class="simple">
<dt>Tasks:</dt><dd><ul class="simple">
<li><p>TODO: fix this function</p></li>
</ul>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>logfile</strong> (<em>-</em>) – filename of the log file you want to parse</p>
</dd>
</dl>
<p>Returns:</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.make_build_text">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">make_build_text</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#make_build_text"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.make_build_text" title="Permalink to this definition"></a></dt>
<dd><p>Function to make build text</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>string containing information about the build and the git branch</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.mem_use">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">mem_use</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#mem_use"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.mem_use" title="Permalink to this definition"></a></dt>
<dd><p>Return current process memory use in MB. (Takes no arguments)</p>
<p>Note: this is per-thread only.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.now">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">now</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">now_object</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">style</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">custom_format</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#now"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.now" title="Permalink to this definition"></a></dt>
<dd><p>convenience function to return a string of the current time, using the format <code class="docutils literal notranslate"><span class="pre">%m/%d/%Y</span> <span class="pre">%H:%M:%S</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>style</strong> – if “nospace” then return the date/time with the format <code class="docutils literal notranslate"><span class="pre">%Y%m%d_%H%M%S</span></code>, else use format <code class="docutils literal notranslate"><span class="pre">%m/%d/%Y</span> <span class="pre">%H:%M:%S</span></code></p></li>
<li><p><strong>custom_format</strong> – if set, uses this as a format rather than whatever is set by default or in the style variable</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.output_lines">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">output_lines</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#output_lines"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.output_lines" title="Permalink to this definition"></a></dt>
<dd><p>Function that outputs the lines that were received from the binary_c run, but now as an iterator.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>output</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – raw binary_c output</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Iterator over the lines of the binary_c output</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.pad_output_distribution">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">pad_output_distribution</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">dist</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">binwidth</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#pad_output_distribution"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.pad_output_distribution" title="Permalink to this definition"></a></dt>
<dd><p>Given a distribution, dist (a dictionary), which should be binned every binwidth (float), fill the distribution with zeros when there is no data. Note: this changes the data in place.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>dist</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code>) – dictionary containing the distribution data.</p></li>
<li><p><strong>binwidth</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code>) – binwidth that is used to fill the distribution with 0 in places where there is no value/key.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.remove_file">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">remove_file</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">file</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">verbosity</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#remove_file"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.remove_file" title="Permalink to this definition"></a></dt>
<dd><p>Function to remove files but with verbosity</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>file</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – full file path to the file that will be removed.</p></li>
<li><p><strong>verbosity</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – current verbosity level (Optional)</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>the path of a sub directory called binary_c_python in the TMP of the file system</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.temp_dir">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">temp_dir</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">child_dirs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#temp_dir"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.temp_dir" title="Permalink to this definition"></a></dt>
<dd><p>Function to create directory within the TMP directory of the file system, starting with <cite>/&lt;TMP&gt;/binary_c_python-&lt;username&gt;</cite></p>
<p>Makes use of os.makedirs exist_ok which requires python 3.2+</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>*child_dirs</strong> – str input where each next input will be a child of the previous full_path. e.g. <code class="docutils literal notranslate"><span class="pre">temp_dir('tests',</span> <span class="pre">'grid')</span></code> will become <code class="docutils literal notranslate"><span class="pre">'/tmp/binary_c_python-&lt;username&gt;/tests/grid'</span></code></p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>the path of a sub directory called binary_c_python in the TMP of the file system</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.timedelta">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">timedelta</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">delta</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#timedelta"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.timedelta" title="Permalink to this definition"></a></dt>
<dd><p>Function to convert a length of time (float, seconds) to a string for
human-readable output.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.trem">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">trem</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">dt</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">count</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dn</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#trem"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.trem" title="Permalink to this definition"></a></dt>
<dd><p>Estimate time remaining (seconds) given a differential time and count (i.e. <code class="docutils literal notranslate"><span class="pre">progress</span> <span class="pre">=</span> <span class="pre">count/n</span></code>).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>dt</strong> – is the time since the last call.</p></li>
<li><p><strong>count</strong> – is the current progress count.</p></li>
<li><p><strong>dn</strong> – is the number run since the last call.</p></li>
<li><p><strong>n</strong> – is the total number required.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.verbose_print">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">verbose_print</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">message</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">verbosity</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">minimal_verbosity</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">newline</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'\\n'</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#verbose_print"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.verbose_print" title="Permalink to this definition"></a></dt>
<dd><p>Function that decides whether to print a message based on the current verbosity
and its minimum verbosity. If verbosity is equal or higher than the minimum, then we print.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>message</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – message to print.</p></li>
<li><p><strong>verbosity</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – current verbosity level.</p></li>
<li><p><strong>minimal_verbosity</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – threshold verbosity above which to print.</p></li>
<li><p><strong>newline</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – newline character (or set of characters), defaults to <code class="docutils literal notranslate"><span class="pre">\n</span></code> but <code class="docutils literal notranslate"><span class="pre">\x0d</span></code> (carriage return) might be useful.</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="binarycpython.utils.functions.write_binary_c_parameter_descriptions_to_rst_file">
<span class="sig-prename descclassname"><span class="pre">binarycpython.utils.functions.</span></span><span class="sig-name descname"><span class="pre">write_binary_c_parameter_descriptions_to_rst_file</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output_file</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/functions.html#write_binary_c_parameter_descriptions_to_rst_file"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#binarycpython.utils.functions.write_binary_c_parameter_descriptions_to_rst_file" title="Permalink to this definition"></a></dt>
<dd><p>Function that calls the get_help_super() to get the help text/descriptions for all the
parameters available in that build.</p>
<p>Writes the results to a .rst file that can be included in the docs.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>output_file</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – name of the output .rst file containing the ReStructuredText formatted output
of all the binary_c parameters.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

</section>


           </div>
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="ensemble.html" class="btn btn-neutral float-left" title="ensemble module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="grid.html" class="btn btn-neutral float-right" title="Population class module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2021, David Hendriks, Robert Izzard.</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
  
<br><br>
Generated on binarycpython git branch: development_0.9.3/2.2.1 git revision f07223abcb24de003f028cab9280aaf9878a1778 url: <a href="https://gitlab.surrey.ac.uk/ri0005/binary_c-python/-/tree/development_0.9.3/2.2.1">git url</a>.
<br><br>
Using binary_c with bit branch branch_david: git revision: "5845:20220107:201620bd7" url: <a href="https://gitlab.surrey.ac.uk/ri0005/binary_c/-/tree/branch_david">git url</a>.



</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>