Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
index.html 23.39 KiB


<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>Welcome to binary_c-python’s documentation! &mdash; binary_c-python  documentation</title>
  

  
  
  
  

  
  <script type="text/javascript" src="_static/js/modernizr.min.js"></script>
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
        <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 type="text/javascript" src="_static/js/theme.js"></script>

    

  
  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="Python module for binary_c" href="readme_link.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="#" 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="main navigation">
          
            
            
              
            
            
              <p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="readme_link.html">Python module for binary_c</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">Binarycpython code</a></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="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="#">binary_c-python</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="#">Docs</a> &raquo;</li>
        
      <li>Welcome to binary_c-python’s documentation!</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="_sources/index.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>
<div class="section" id="welcome-to-binary-c-python-s-documentation">
<h1>Welcome to binary_c-python’s documentation!<a class="headerlink" href="#welcome-to-binary-c-python-s-documentation" title="Permalink to this headline">¶</a></h1>
</div>
<div class="section" id="python-module-for-binary-c">
<h1>Python module for binary_c<a class="headerlink" href="#python-module-for-binary-c" title="Permalink to this headline">¶</a></h1>
<p>Docstring coverage:</p>
<a class="reference external image-reference" href="./badges/docstring_coverage.svg"><img alt="docstring coverage" src="_images/docstring_coverage.svg" /></a>
<p>Test coverage:</p>
<a class="reference external image-reference" href="./badges/test_coverage.svg"><img alt="test coverage" src="_images/test_coverage.svg" /></a>
<p>Binary population synthesis code that interfaces with binary_c. Based on a original work by Jeff Andrews. Updated and extended for Python3 by David Hendriks, Robert Izzard.</p>
<p>The current release is version <a class="reference external" href="VERSION">version</a>, make sure to use that version number when installing!</p>
<div class="section" id="requirements">
<h2>Requirements<a class="headerlink" href="#requirements" title="Permalink to this headline">¶</a></h2>
<p>To run this code you need to at least have installations of:</p>
<ul class="simple">
<li><p>Python 3.6 or higher</p></li>
<li><p>binary_c version 2.1.7 or higher</p></li>
</ul>
<p>And the following python packages (which will get installed automatically when installing with pip):</p>
<ul class="simple">
<li><p>numpy</p></li>
<li><p>pytest</p></li>
<li><p>h5py</p></li>
<li><p>pathos</p></li>
<li><p>pandas</p></li>
<li><p>astropy</p></li>
<li><p>matplotlib</p></li>
<li><p>py_rinterpolate</p></li>
</ul>
</div>
<div class="section" id="environment-variables">
<h2>Environment variables<a class="headerlink" href="#environment-variables" title="Permalink to this headline">¶</a></h2>
<p>Before compilation you need to have certain environment variables:</p>
<p>Required:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">BINARY_C</span></code> should point to the root directory of your binary_c installation</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">LD_LIBRARY_PATH</span></code> should include $BINARY_C/src and whatever directories are required to run binary_c (e.g. locations of libgsl, libmemoize, librinterpolate, etc.)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">LIBRARY_PATH</span></code> should include whatever directories are required to build binary_c (e.g. locations of libgsl, libmemoize, librinterpolate, etc.)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">GSL_DIR</span></code> should point to the root location where you installed GSL to. This root dir should contain <code class="docutils literal notranslate"><span class="pre">bin/</span></code>, <code class="docutils literal notranslate"><span class="pre">lib/</span></code> etc</p></li>
</ul>
</div>
<div class="section" id="build-instructions">
<h2>Build instructions<a class="headerlink" href="#build-instructions" title="Permalink to this headline">¶</a></h2>
<p>First, make sure you have built binary_c (See <code class="docutils literal notranslate"><span class="pre">$BINARY_C/doc/binary_c2.pdf</span></code> section: installation for all the installation instructions for <code class="docutils literal notranslate"><span class="pre">binary_c</span></code>)) and that it functions correctly.</p>
<div class="section" id="installation-via-pip">
<h3>Installation via PIP:<a class="headerlink" href="#installation-via-pip" title="Permalink to this headline">¶</a></h3>
<p>To install this package via pip:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="n">install</span> <span class="n">binarycpython</span>
</pre></div>
</div>
<p>This will install the latest stable installation that is available on pip.</p>
</div>
<div class="section" id="installation-from-source">
<h3>Installation from source:<a class="headerlink" href="#installation-from-source" title="Permalink to this headline">¶</a></h3>
<p>We can also install the package from source, which is useful for development versions and when you want to modify the code. It is recommended that you install this into a virtual environment. From within the root directory, run</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">./</span><span class="n">install</span><span class="o">.</span><span class="n">sh</span>
</pre></div>
</div>
<p>This will install the package, along with all the dependencies.</p>
<p>If this is not the first time you install the package, but rather rebuild it because you made changes in either binary_c or binarycpython, you can run</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">./</span><span class="n">install_without_dependencies</span><span class="o">.</span><span class="n">sh</span>
</pre></div>
</div>
<p>to reinstall just binarycpython.</p>
<div class="section" id="after-installation">
<h4>After installation<a class="headerlink" href="#after-installation" title="Permalink to this headline">¶</a></h4>
<p>After installing the code via source it is useful to run the test suite before doing any programming with it. The test suite is stored in <code class="docutils literal notranslate"><span class="pre">binarycpython/tests</span></code> and running <code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">main.py</span></code> in there will run all the tests.</p>
</div>
</div>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
<p>See the examples/ directory for example scripts and notebooks. The documentation contains example pages as well.</p>
</div>
<div class="section" id="usage-notes">
<h2>Usage notes<a class="headerlink" href="#usage-notes" title="Permalink to this headline">¶</a></h2>
<p>Make sure that with every change/recompilation you make in <code class="docutils literal notranslate"><span class="pre">binary_c</span></code>, you also rebuild this package. Whenever you change the sourcecode of this package, you need to reinstall it into your virtualenvironment as well</p>
</div>
<div class="section" id="documentation">
<h2>Documentation<a class="headerlink" href="#documentation" title="Permalink to this headline">¶</a></h2>
<p>Look in the docs/ directory. Within the build/html/ there is the html version of the documentation. The</p>
</div>
<div class="section" id="development">
<h2>Development:<a class="headerlink" href="#development" title="Permalink to this headline">¶</a></h2>
<p>If you want to contribute to the code, then it is recommended that you install the packages in <code class="docutils literal notranslate"><span class="pre">development_requirements.txt</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="n">install</span> <span class="o">-</span><span class="n">r</span> <span class="n">development_requirements</span><span class="o">.</span><span class="n">txt</span>
</pre></div>
</div>
</div>
<div class="section" id="faq-issues">
<h2>FAQ/Issues:<a class="headerlink" href="#faq-issues" title="Permalink to this headline">¶</a></h2>
<p>Building issues with binary_c itself:</p>
<ul class="simple">
<li><p>see the documentation of binary_c (in doc/).</p></li>
<li><p>If you have MESA installed, make sure that the <code class="docutils literal notranslate"><span class="pre">$MESASDK_ROOT/bin/mesasdk_init.sh</span></code> is not sourced. It comes with its own version of some programs, and those can interfere with installing.</p></li>
</ul>
<p>When Pip install fails:</p>
<ul class="simple">
<li><p>Run the installation with <code class="docutils literal notranslate"><span class="pre">-v</span></code> and/or <code class="docutils literal notranslate"><span class="pre">--log</span> <span class="pre">&lt;logfile&gt;</span></code> to get some more info</p></li>
<li><p>If gcc throws errors like <code class="docutils literal notranslate"><span class="pre">gcc:</span> <span class="pre">error:</span> <span class="pre">unrecognized</span> <span class="pre">command</span> <span class="pre">line</span> <span class="pre">option</span> <span class="pre">‘-ftz’;</span> <span class="pre">did</span> <span class="pre">you</span> <span class="pre">mean</span> <span class="pre">‘-flto’?</span></code>, this might be due to that the python on that system was built with a different compiler. It then passes the python3.6-config –cflags to the binarycpython installation, which, if done with gcc, will not work. Try a different python3.6. I suggest using <code class="docutils literal notranslate"><span class="pre">pyenv</span></code> to manage python versions. If installing a version of python with pyenv is not possible, then try to use a python version that is avaible to the machine that is built with the same compiler as binary_c was built with.</p></li>
<li><p>if pip installation results in <code class="docutils literal notranslate"><span class="pre">No</span> <span class="pre">files/directories</span> <span class="pre">in</span> <span class="pre">/tmp/pip-1ckzg0p9-build/pip-egg-info</span> <span class="pre">(from</span> <span class="pre">PKG-INFO)</span></code>, try running it verbose (<code class="docutils literal notranslate"><span class="pre">-v</span></code>) to see what is actually going wrong.</p></li>
<li><p>If pip terminates with the error FileNotFoundError: [Errno 2] No such file or directory: ‘&lt;…&gt;/binary_c-config’ Then make sure that the path to your main $BINARY_C directory is set correctly.</p></li>
</ul>
<p>Other:</p>
<ul class="simple">
<li><p>When running jupyter notebooks, make sure you are running the jupyter installation from the same virtual environment.</p></li>
<li><p>When the output of binary_c seems to be different than expected, you might need to rebuild this python package. Everytime binary_c is compiled, this package needs to be rebuilt too.</p></li>
</ul>
<div class="toctree-wrapper compound">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="readme_link.html">Python module for binary_c</a><ul>
<li class="toctree-l2"><a class="reference internal" href="readme_link.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="readme_link.html#environment-variables">Environment variables</a></li>
<li class="toctree-l2"><a class="reference internal" href="readme_link.html#build-instructions">Build instructions</a></li>
<li class="toctree-l2"><a class="reference internal" href="readme_link.html#examples">Examples</a></li>
<li class="toctree-l2"><a class="reference internal" href="readme_link.html#usage-notes">Usage notes</a></li>
<li class="toctree-l2"><a class="reference internal" href="readme_link.html#documentation">Documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="readme_link.html#development">Development:</a></li>
<li class="toctree-l2"><a class="reference internal" href="readme_link.html#faq-issues">FAQ/Issues:</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">Binarycpython code</a><ul>
<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="distribution_functions.html">distribution_functions module</a></li>
<li class="toctree-l2"><a class="reference internal" href="functions.html">functions module</a></li>
<li class="toctree-l2"><a class="reference internal" href="grid.html">grid_class module</a></li>
<li class="toctree-l2"><a class="reference internal" href="grid_options_defaults.html">Grid options and descriptions</a></li>
<li class="toctree-l2"><a class="reference internal" href="hpc_functions.html">hpc_functions 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="run_system_wrapper.html">run_system_wrapper module</a></li>
<li class="toctree-l2"><a class="reference internal" href="spacing_functions.html">spacing_functions 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><ul>
<li class="toctree-l2"><a class="reference internal" href="examples/notebook_individual_systems.html">Tutorial: Running individual systems with binary_c-python</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples/notebook_custom_logging.html">Tutorial: Using custom logging routines with binary_c-python</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples/notebook_population.html">Tutorial: Running populations with binary_c-python</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples/notebook_extra_features.html">Tutorial: Extra features and functionality of binary_c-python</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples/notebook_api_functionality.html">Tutorial: Using the API functionality of binary_c-python</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples/notebook_luminosity_function_single.html">Example use case: Zero-age stellar luminosity function</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples/notebook_luminosity_function_binaries.html">Example use case: Zero-age stellar luminosity function in binaries</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples/notebook_HRD.html">Example use case: Hertzsprung-Russell diagrams</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples/notebook_common_envelope_evolution.html">Example use case: Common-envelope evolution</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples/notebook_BHBH.html">Example use case: Binary black hole systems</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples/notebook_massive_remnants.html">Example use case: Massive star luminosity</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples/notebook_solar_system.html">Example use case: Solar system using the API functionality</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="binary_c_parameters.html">Binary_c parameters</a><ul>
<li class="toctree-l2"><a class="reference internal" href="binary_c_parameters.html#section-stars">Section: stars</a></li>
<li class="toctree-l2"><a class="reference internal" href="binary_c_parameters.html#section-binary">Section: binary</a></li>
<li class="toctree-l2"><a class="reference internal" href="binary_c_parameters.html#section-nucsyn">Section: nucsyn</a></li>
<li class="toctree-l2"><a class="reference internal" href="binary_c_parameters.html#section-output">Section: output</a></li>
<li class="toctree-l2"><a class="reference internal" href="binary_c_parameters.html#section-input">Section: input</a></li>
<li class="toctree-l2"><a class="reference internal" href="binary_c_parameters.html#section-i-o">Section: i/o</a></li>
<li class="toctree-l2"><a class="reference internal" href="binary_c_parameters.html#section-algorithms">Section: algorithms</a></li>
<li class="toctree-l2"><a class="reference internal" href="binary_c_parameters.html#section-misc">Section: misc</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="grid_options_descriptions.html">Population grid code options</a><ul>
<li class="toctree-l2"><a class="reference internal" href="grid_options_descriptions.html#public-options">Public options</a></li>
<li class="toctree-l2"><a class="reference internal" href="grid_options_descriptions.html#moe-di-stefano-sampler-options">Moe &amp; di Stefano sampler options</a></li>
<li class="toctree-l2"><a class="reference internal" href="grid_options_descriptions.html#private-options">Private options</a></li>
</ul>
</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>
</div>
<div class="section" id="indices-and-tables">
<h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline">¶</a></h1>
<ul class="simple">
<li><p><a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a></p></li>
<li><p><a class="reference internal" href="py-modindex.html"><span class="std std-ref">Module Index</span></a></p></li>
<li><p><a class="reference internal" href="search.html"><span class="std std-ref">Search Page</span></a></p></li>
</ul>
</div>


           </div>
           
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="readme_link.html" class="btn btn-neutral float-right" title="Python module for binary_c" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2021, David Hendriks, Robert Izzard

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/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 c28d981dead0092cf26fb560b88691d228bafd9c 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: "5834:20211216:a3146490e" url: <a href="https://gitlab.surrey.ac.uk/ri0005/binary_c/-/tree/branch_david">git url</a>.



</footer>

        </div>
      </div>

    </section>

  </div>
  


  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>