<!DOCTYPE html> <html class="writer-html5" lang="en" > <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>grid_class module — binary_c-python documentation</title> <link rel="stylesheet" href="_static/css/theme.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <!--[if lt IE 9]> <script src="_static/js/html5shiv.min.js"></script> <![endif]--> <script type="text/javascript" id="documentation_options" data-url_root="./" 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 src="_static/language_data.js"></script> <script type="text/javascript" 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="Grid options and descriptions" href="grid_options_defaults.html" /> <link rel="prev" title="functions module" href="functions.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" alt="Documentation 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"><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="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 current"><a class="current reference internal" href="#">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="examples.html">Examples</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="index.html">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="index.html" class="icon icon-home"></a> »</li> <li><a href="modules.html">Binarycpython code</a> »</li> <li>grid_class module</li> <li class="wy-breadcrumbs-aside"> <a href="_sources/grid.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"> <div class="section" id="module-binarycpython.utils.grid"> <span id="grid-class-module"></span><h1>grid_class module<a class="headerlink" href="#module-binarycpython.utils.grid" title="Permalink to this headline">¶</a></h1> <p>Module containing the Population grid class object.</p> <p>Here all the functionality of a Population object is defined.</p> <p>Useful for the user to understand the functionality, but copying functionality isn’t recommended except if you know what you are doing</p> <dl class="simple"> <dt>Tasks:</dt><dd><ul class="simple"> <li><p>TODO: add functionality to ‘on-init’ set arguments</p></li> <li><p>TODO: add functionality to return the initial_abundance_hash</p></li> <li><p>TODO: add functionality to return the isotope_hash</p></li> <li><p>TODO: add functionality to return the isotope_list</p></li> <li><p>TODO: add functionality to return the nuclear_mass_hash</p></li> <li><p>TODO: add functionality to return the nuclear_mass_list</p></li> <li><p>TODO: add functionality to return the source_list</p></li> <li><p>TODO: add functionality to return the ensemble_list</p></li> <li><p>TODO: consider spreading the functions over more files.</p></li> <li><p>TODO: type the private functions</p></li> <li><p>TODO: fix the correct object types for the default values of the bse_options</p></li> <li><p>TODO: uncomment and implement the HPC functionality</p></li> <li><p>TODO: think of a clean and nice way to unload and remove the custom_logging_info library from memory (and from disk)</p></li> <li><p>TODO: think of a nice way to remove the loaded grid_code/ generator from memory.</p></li> <li><p>TODO: Create a designated dict for results</p></li> </ul> </dd> </dl> <dl class="py class"> <dt id="binarycpython.utils.grid.Population"> <em class="property">class </em><code class="sig-prename descclassname">binarycpython.utils.grid.</code><code class="sig-name descname">Population</code><a class="reference internal" href="_modules/binarycpython/utils/grid.html#Population"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#binarycpython.utils.grid.Population" 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>Population Object. Contains all the necessary functions to set up, run and process a population of systems</p> <dl class="py method"> <dt id="binarycpython.utils.grid.Population.Moe_de_Stefano_2017"> <code class="sig-name descname">Moe_de_Stefano_2017</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">options</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/grid.html#Population.Moe_de_Stefano_2017"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#binarycpython.utils.grid.Population.Moe_de_Stefano_2017" title="Permalink to this definition">¶</a></dt> <dd><p>Function to handle setting the user input settings, set up the data and load that into interpolators and and then set the distribution functions</p> <p>Takes a dictionary as its only argument</p> </dd></dl> <dl class="py method"> <dt id="binarycpython.utils.grid.Population.add_grid_variable"> <code class="sig-name descname">add_grid_variable</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">longname</span></em>, <em class="sig-param"><span class="n">valuerange</span></em>, <em class="sig-param"><span class="n">resolution</span></em>, <em class="sig-param"><span class="n">spacingfunc</span></em>, <em class="sig-param"><span class="n">probdist</span></em>, <em class="sig-param"><span class="n">dphasevol</span></em>, <em class="sig-param"><span class="n">parameter_name</span></em>, <em class="sig-param"><span class="n">gridtype</span><span class="o">=</span><span class="default_value">'edge'</span></em>, <em class="sig-param"><span class="n">branchpoint</span><span class="o">=</span><span class="default_value">0</span></em>, <em class="sig-param"><span class="n">precode</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">condition</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/grid.html#Population.add_grid_variable"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#binarycpython.utils.grid.Population.add_grid_variable" title="Permalink to this definition">¶</a></dt> <dd><p>Function to add grid variables to the grid_options.</p> <p>The execution of the grid generation will be through a nested forloop. Each of the grid variables will get create a deeper for loop.</p> <p>The real function that generates the numbers will get written to a new file in the TMP_DIR, and then loaded imported and evaluated. beware that if you insert some destructive piece of code, it will be executed anyway. Use at own risk.</p> <dl class="simple"> <dt>Tasks:</dt><dd><ul class="simple"> <li><p>TODO: Fix this complex function.</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>name</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – <p>name of parameter. This is evaluated as a parameter and you can use it throughout the rest of the function</p> <p class="rubric">Examples</p> <p>name = ‘lnm1’</p> </p></li> <li><p><strong>longname</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – <p>Long name of parameter</p> <p class="rubric">Examples</p> <p>longname = ‘Primary mass’</p> </p></li> <li><p><strong>range</strong> – <p>Range of values to take. Does not get used really, the spacingfunction is used to get the values from</p> <p class="rubric">Examples</p> <p>range = [math.log(m_min), math.log(m_max)]</p> </p></li> <li><p><strong>resolution</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – <p>Resolution of the sampled range (amount of samples). TODO: check if this is used anywhere</p> <p class="rubric">Examples</p> <p>resolution = resolution[“M_1”]</p> </p></li> <li><p><strong>spacingfunction</strong> – <p>Function determining how the range is sampled. You can either use a real function, or a string representation of a function call. Will get written to a file and then evaluated.</p> <p class="rubric">Examples</p> <p>spacingfunction = “const(math.log(m_min), math.log(m_max), {})”.format(resolution[‘M_1’])</p> </p></li> <li><p><strong>precode</strong> (<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">str</span></code>]) – <p>Extra room for some code. This code will be evaluated within the loop of the sampling function (i.e. a value for lnm1 is chosen already)</p> <p class="rubric">Examples</p> <p>precode = ‘M_1=math.exp(lnm1);’</p> </p></li> <li><p><strong>probdist</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – <p>FUnction determining the probability that gets asigned to the sampled parameter</p> <p class="rubric">Examples</p> <p>probdist = ‘Kroupa2001(M_1)*M_1’</p> </p></li> <li><p><strong>dphasevol</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">int</span></code>]) – <p>part of the parameter space that the total probability is calculated with. Put to -1 if you want to ignore any dphasevol calculations and set the value to 1 .. rubric:: Examples</p> <p>dphasevol = ‘dlnm1’</p> </p></li> <li><p><strong>condition</strong> (<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">str</span></code>]) – <p>condition that has to be met in order for the grid generation to continue .. rubric:: Examples</p> <p>condition = ‘self.grid_options[‘binary’]==1’</p> </p></li> <li><p><strong>gridtype</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – Method on how the value range is sampled. Can be either ‘edge’ (steps starting at the lower edge of the value range) or ‘center’ (steps starting at lower edge + 0.5 * stepsize).</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 method"> <dt id="binarycpython.utils.grid.Population.evolve"> <code class="sig-name descname">evolve</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/grid.html#Population.evolve"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#binarycpython.utils.grid.Population.evolve" title="Permalink to this definition">¶</a></dt> <dd><p>Entrypoint function of the whole object. From here, based on the settings, we set up a SLURM or CONDOR grid, or if no setting is given we go straight to evolving the population</p> <dl class="simple"> <dt>There are no direct arguments to this function, rather it is based on the grid_options settings:</dt><dd><p>grid_options[‘slurm’]: integer boolean whether to use a slurm_grid evolution grid_options[‘condor’]: integer boolean whether to use a condor_grid evolution</p> </dd> </dl> <p>If neither of the above is set, we continue without using HPC routines (that doesn’t mean this cannot be run on a server with many cores)</p> <p>Returns an dictionary containing the analytics of the run TODO: change the way this is done. Slurm & CONDOR should probably do this different</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 method"> <dt id="binarycpython.utils.grid.Population.evolve_population"> <code class="sig-name descname">evolve_population</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/grid.html#Population.evolve_population"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#binarycpython.utils.grid.Population.evolve_population" title="Permalink to this definition">¶</a></dt> <dd><p>Function to evolve populations. This handles the setting up, evolving and cleaning up of a population of stars.</p> <dl class="simple"> <dt>Choices here are:</dt><dd><p>to evolve a population via multiprocessing or linearly on 1 core. NOT IMPLEMENTED YET to evolve a population via a variable grid, a source file or MC</p> </dd> <dt>Tasks:</dt><dd><ul class="simple"> <li><p>TODO: include options for different ways of generating a population here. (i.e. MC or source file)</p></li> </ul> </dd> </dl> </dd></dl> <dl class="py method"> <dt id="binarycpython.utils.grid.Population.evolve_single"> <code class="sig-name descname">evolve_single</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">clean_up_custom_logging_files</span><span class="o">=</span><span class="default_value">True</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/grid.html#Population.evolve_single"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#binarycpython.utils.grid.Population.evolve_single" title="Permalink to this definition">¶</a></dt> <dd><p>Function to run a single system, based on the settings in the grid_options</p> <p>The output of the run gets returned, unless a parse function is given to this function.</p> <dl class="field-list simple"> <dt class="field-odd">Parameters</dt> <dd class="field-odd"><p><strong>clean_up_custom_logging_files</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – whether the clean up all the custom_logging files.</p> </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">Any</span></code></p> </dd> <dt class="field-odd">Returns</dt> <dd class="field-odd"><p>either returns the raw binary_c output, or whatever the parse_function does</p> </dd> </dl> </dd></dl> <dl class="py method"> <dt id="binarycpython.utils.grid.Population.export_all_info"> <code class="sig-name descname">export_all_info</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">use_datadir</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">outfile</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">include_population_settings</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">include_binary_c_defaults</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">include_binary_c_version_info</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">include_binary_c_help_all</span><span class="o">=</span><span class="default_value">True</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/grid.html#Population.export_all_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#binarycpython.utils.grid.Population.export_all_info" title="Permalink to this definition">¶</a></dt> <dd><p>Function that exports the all_info to a json file</p> <dl class="simple"> <dt>Tasks:</dt><dd><ul class="simple"> <li><dl class="simple"> <dt>TODO: if any of the values in the dicts here is of a not-serializable form, then we</dt><dd><p>need to change that to a string or something so, use a recursive function that goes over the all_info dict and finds those that fit</p> </dd> </dl> </li> <li><p>TODO: Fix to write things to the directory. which options do which etc</p></li> <li><p>TODO: theres flawed logic here. rewrite this part pls</p></li> <li><dl class="simple"> <dt>TODO: consider actually just removing the whole ‘output to file’ part and let the</dt><dd><p>user do this.</p> </dd> </dl> </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>include_population_settings</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – whether to include the population_settings (see function return_population_settings)</p></li> <li><p><strong>include_binary_c_defaults</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – whether to include a dict containing the binary_c parameters and their default values</p></li> <li><p><strong>include_binary_c_version_info</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – whether to include a dict containing all the binary_c version info (see return_binary_c_version_info)</p></li> <li><p><strong>include_binary_c_help_all</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – whether to include a dict containing all the information about the binary_c parameters (see get_help_all)</p></li> <li><p><strong>use_datadir</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – boolean whether to use the custom_options[‘data_dir’] to write the file to. If the custom_options[“base_filename”] is set, the output file will be called <custom_options[“base_filename”]>_settings.json. Otherwise a file called simulation_<date+time>_settings.json will be created</p></li> <li><p><strong>outfile</strong> (<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">str</span></code>]) – if use_datadir is false, a custom filename will be used</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">str</span></code>]</p> </dd> </dl> </dd></dl> <dl class="py method"> <dt id="binarycpython.utils.grid.Population.format_ensemble_results"> <code class="sig-name descname">format_ensemble_results</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">ensemble_dictionary</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/grid.html#Population.format_ensemble_results"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#binarycpython.utils.grid.Population.format_ensemble_results" title="Permalink to this definition">¶</a></dt> <dd><p>Function to handle all the steps of formatting the ensemble output again.</p> <dl class="simple"> <dt>Input:</dt><dd><p>ensemble_dictionary: dictionary containing all the ensemble results</p> </dd> </dl> </dd></dl> <dl class="py method"> <dt id="binarycpython.utils.grid.Population.get_stream_logger"> <code class="sig-name descname">get_stream_logger</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">level</span><span class="o">=</span><span class="default_value">10</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/grid.html#Population.get_stream_logger"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#binarycpython.utils.grid.Population.get_stream_logger" title="Permalink to this definition">¶</a></dt> <dd><p>Return logger with configured StreamHandler.</p> </dd></dl> <dl class="py method"> <dt id="binarycpython.utils.grid.Population.last_grid_variable"> <code class="sig-name descname">last_grid_variable</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/grid.html#Population.last_grid_variable"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#binarycpython.utils.grid.Population.last_grid_variable" title="Permalink to this definition">¶</a></dt> <dd><p>Functon that returns the last grid variable (i.e. the one with the highest grid_variable_number)</p> </dd></dl> <dl class="py method"> <dt id="binarycpython.utils.grid.Population.parse_cmdline"> <code class="sig-name descname">parse_cmdline</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/grid.html#Population.parse_cmdline"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#binarycpython.utils.grid.Population.parse_cmdline" title="Permalink to this definition">¶</a></dt> <dd><p>Function to handle settings values via the command line. Best to be called after all the .set(..) lines, and just before the .evolve() is called</p> <p>If you input any known parameter (i.e. contained in grid_options, defaults/bse_options or custom_options), this function will attempt to convert the input from string (because everything is string) to the type of the value that option had before.</p> <p>The values of the bse_options are initially all strings, but after user input they can change to ints.</p> <p>The value of any new parameter (which will go to custom_options) will be a string.</p> <dl class="simple"> <dt>Tasks:</dt><dd><ul class="simple"> <li><p>TODO: remove the need for –cmdline</p></li> </ul> </dd> </dl> <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 method"> <dt id="binarycpython.utils.grid.Population.return_all_info"> <code class="sig-name descname">return_all_info</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">include_population_settings</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">include_binary_c_defaults</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">include_binary_c_version_info</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">include_binary_c_help_all</span><span class="o">=</span><span class="default_value">True</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/grid.html#Population.return_all_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#binarycpython.utils.grid.Population.return_all_info" title="Permalink to this definition">¶</a></dt> <dd><p>Function that returns all the information about the population and binary_c</p> <dl class="field-list simple"> <dt class="field-odd">Parameters</dt> <dd class="field-odd"><ul class="simple"> <li><p><strong>include_population_settings</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – whether to include the population_settings (see function return_population_settings)</p></li> <li><p><strong>include_binary_c_defaults</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – whether to include a dict containing the binary_c parameters and their default values</p></li> <li><p><strong>include_binary_c_version_info</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – whether to include a dict containing all the binary_c version info (see return_binary_c_version_info)</p></li> <li><p><strong>include_binary_c_help_all</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – whether to include a dict containing all the information about the binary_c parameters (see get_help_all)</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, or part of, the above dictionaries</p> </dd> </dl> </dd></dl> <dl class="py method"> <dt id="binarycpython.utils.grid.Population.return_population_settings"> <code class="sig-name descname">return_population_settings</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/grid.html#Population.return_population_settings"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#binarycpython.utils.grid.Population.return_population_settings" title="Permalink to this definition">¶</a></dt> <dd><p>Function that returns all the options that have been set.</p> <p>Can be combined with json to make a nice file.</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">dict</span></code></p> </dd> <dt class="field-even">Returns</dt> <dd class="field-even"><p>dictionary containing “bse_options”, “grid_options”, “custom_options”</p> </dd> </dl> </dd></dl> <dl class="py method"> <dt id="binarycpython.utils.grid.Population.set"> <code class="sig-name descname">set</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/grid.html#Population.set"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#binarycpython.utils.grid.Population.set" title="Permalink to this definition">¶</a></dt> <dd><p>Function to set the values of the population. This is the preferred method to set values of functions, as it provides checks on the input.</p> <p>the bse_options will get populated with all the those that have a key that is present in the self.defaults</p> <p>the grid_options will get updated with all the those that have a key that is present in the self.grid_options</p> <p>If neither of above is met; the key and the value get stored in a custom_options dict.</p> <dl class="field-list simple"> <dt class="field-odd">Parameters</dt> <dd class="field-odd"><ul class="simple"> <li><p><strong>kwargs all the arguments are either set to binary_c parameters</strong> (<em>via</em>) – </p></li> <li><p><strong>or custom_options</strong> (<em>grid_options</em>) – </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 method"> <dt id="binarycpython.utils.grid.Population.set_moe_distefano_settings"> <code class="sig-name descname">set_moe_distefano_settings</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">options</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/grid.html#Population.set_moe_distefano_settings"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#binarycpython.utils.grid.Population.set_moe_distefano_settings" title="Permalink to this definition">¶</a></dt> <dd><p>Function to set user input configurations for the moe & distefano methods</p> <p>If nothing is passed then we just use the default options</p> </dd></dl> <dl class="py method"> <dt id="binarycpython.utils.grid.Population.system_queue_filler"> <code class="sig-name descname">system_queue_filler</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">job_queue</span></em>, <em class="sig-param"><span class="n">amt_cores</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/grid.html#Population.system_queue_filler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#binarycpython.utils.grid.Population.system_queue_filler" title="Permalink to this definition">¶</a></dt> <dd><p>Function that is responsible for keeping the queue filled.</p> <p>This will generate the systems until it is full, and then keeps trying to fill it. Will have to play with the size of this.</p> </dd></dl> <dl class="py method"> <dt id="binarycpython.utils.grid.Population.write_binary_c_calls_to_file"> <code class="sig-name descname">write_binary_c_calls_to_file</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">output_dir</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">output_filename</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">include_defaults</span><span class="o">=</span><span class="default_value">False</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/binarycpython/utils/grid.html#Population.write_binary_c_calls_to_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#binarycpython.utils.grid.Population.write_binary_c_calls_to_file" title="Permalink to this definition">¶</a></dt> <dd><p>Function that loops over the gridcode and writes the generated parameters to a file. In the form of a commandline call</p> <p>Only useful when you have a variable grid as system_generator. MC wouldnt be that useful</p> <p>Also, make sure that in this export there are the basic parameters like m1,m2,sep, orb-per, ecc, probability etc.</p> <p>On default this will write to the datadir, if it exists</p> <p>WARNING; dont use yet. not fully tested.</p> <dl class="simple"> <dt>Tasks:</dt><dd><ul class="simple"> <li><p>TODO: test this function</p></li> <li><p>TODO: make sure the binary_c_python .. output file has a unique name</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_dir</strong> (<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">str</span></code>]) – (optional, default = None) directory where to write the file to. If custom_options[‘data_dir’] is present, then that one will be used first, and then the output_dir</p></li> <li><p><strong>output_filename</strong> (<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">str</span></code>]) – (optional, default = None) filename of the output. If not set it will be called “binary_c_calls.txt”</p></li> <li><p><strong>include_defaults</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – (optional, default = None) whether to include the defaults of binary_c in the lines that are written. Beware that this will result in very long lines, and it might be better to just export the binary_c defaults and keep them in a seperate file.</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> </dd></dl> </div> </div> </div> <footer> <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> <a href="grid_options_defaults.html" class="btn btn-neutral float-right" title="Grid options and descriptions" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a> <a href="functions.html" class="btn btn-neutral float-left" title="functions module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a> </div> <hr/> <div role="contentinfo"> <p> © 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_version/2.1.7 git revision 22f07b8a31dab843d58073f9b3da63a5f40b852b url: <a href="https://gitlab.eps.surrey.ac.uk/ri0005/binary_c-python/-/tree/development_version/2.1.7">git url</a>. <br><br> Using binary_c with bit branch branch_david: git revision: "6044:20210720:d1ed5b6c1" url: <a href="https://gitlab.eps.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>