Commit aadddff5 authored by David Hendriks's avatar David Hendriks
Browse files

Merge branch 'feature/binarycfraction' into moe_destefano

parents 1cd1bcf4 f182d1b5
Loading
Loading
Loading
Loading
+63 −69
Original line number Diff line number Diff line
@@ -946,15 +946,11 @@ def cosmic_SFH_madau_dickinson2014(z):
# known value if we try to interpolate outside of the tables.
# There are still some open tasks and improvements that can be made:
#
# TODO: check all the raise ValueErrors to make them more appropriate
# TODO: Put the json checking stuff in a different function
# TODO: Clean up the logging
# TODO: Solve the memory issues that are present. 
#    Are the interpolators not cleaned? 
# TODO: Parallellize the setting up of the interpolators
# TODO: Generalize the code such that we can input other/newer tables


########################################################################

import py_rinterpolate
@@ -1129,7 +1125,7 @@ def Moe_de_Stefano_2017_multiplicity_fractions(options, verbosity=0):

    if options["multiplicity_model"] == "Poisson":
        multiplicity = Moecache["rinterpolator_multiplicity"].interpolate(
            [np.log10(options["M1"])]
            [np.log10(options["M_1"])]
        )[0]

        # Fill the multiplicity array
@@ -1155,7 +1151,7 @@ def Moe_de_Stefano_2017_multiplicity_fractions(options, verbosity=0):
        for n in range(3):
            full_fractions_array[n] = (
                Moecache["rinterpolator_multiplicity"].interpolate(
                    [np.log10(options["M1"])]
                    [np.log10(options["M_1"])]
                )[n + 1])

        # Set last value
@@ -1265,8 +1261,6 @@ def build_q_table(options, m, p, verbosity=0):
                    verbosity,
                    _MS_VERBOSITY_LEVEL,
                )
                Moecache["rinterpolator_q_given_{}_log10{}".format(m, p)].destroy()
                gc.collect()

    #
    if not incache:
@@ -1278,7 +1272,7 @@ def build_q_table(options, m, p, verbosity=0):
        #     0
        # ]  # TODO: this lower range must not be lower than Mmin.
        # print("build_q_table qmin: {}".format(qmin))
        qmin = options['Mmin']/options['M1']
        qmin = options['Mmin']/options['M_1']
        print("build_q_table qmin: {}".format(qmin))

        # qmax = maximum_mass_ratio_for_RLOF(options[m], options[p])
@@ -1823,7 +1817,7 @@ def Moe_de_Stefano_2017_pdf(options, verbosity=0):
    prob_dict['multiplicity'] = multiplicity_probability
    verbose_print(
        "\tM&S: Moe_de_Stefano_2017_pdf: Appended multiplicity (mass1 = {}) probability ({}) to the prob dict ({})".format(
            options["M1"], prob_dict['multiplicity'], prob_dict
            options["M_1"], prob_dict['multiplicity'], prob_dict
        ),
        verbosity,
        _MS_VERBOSITY_LEVEL,
@@ -1837,11 +1831,11 @@ def Moe_de_Stefano_2017_pdf(options, verbosity=0):

    # TODO: Create an n-part-powerlaw method that can have breakpoints and slopes. I'm using a three-part powerlaw now.
    # TODO: is this actually the correct way? putting the M1 in there? Do we sample in logspace?
    M1_probability = Kroupa2001(options["M1"]) * options["M1"]
    prob_dict['M1'] = M1_probability
    M1_probability = Kroupa2001(options["M_1"]) * options["M_1"]
    prob_dict['M_1'] = M1_probability
    verbose_print(
        "\tM&S: Moe_de_Stefano_2017_pdf: Appended Mass (m={}) probability ({}) to the prob dict ({})".format(
            options["M1"], prob_dict['M1'], prob_dict
            options["M_1"], prob_dict['M_1'], prob_dict
        ),
        verbosity,
        _MS_VERBOSITY_LEVEL,
@@ -1876,7 +1870,7 @@ def Moe_de_Stefano_2017_pdf(options, verbosity=0):
            )

        # Make a table storing Moe's data for q distributions
        if options.get("M2", None) or options.get("M3", None) or options.get("M4", None):
        if options.get("M_2", None) or options.get("M_3", None) or options.get("M_4", None):
            if not Moecache.get("rinterpolator_q", None):
                Moecache["rinterpolator_q"] = py_rinterpolate.Rinterpolate(
                    table=Moecache["q_distributions"],  # Contains the table of data
@@ -1913,30 +1907,30 @@ def Moe_de_Stefano_2017_pdf(options, verbosity=0):
        ###############
        # Calculation for period of the binary

        if options.get("M2", None):
        if options.get("M_2", None):
            # Separation of the inner binary
            options["sep"] = calc_sep_from_period(
                options["M1"], options["M2"], options["P"]
                options["M_1"], options["M_2"], options["P"]
            )
            # TODO: add check for min_P with instant RLOF?
            # TODO: Actually use the value above.
            # Total mass inner binary:
            options["M1+M2"] = options["M1"] + options["M2"]
            options["M_1+M_2"] = options["M_1"] + options["M_2"]

        # Calculate P integral or use cached value
        calc_P_integral(
            options, 1, "P_integrals", "rinterpolator_log10P", "M1", verbosity
            options, 1, "P_integrals", "rinterpolator_log10P", "M_1", verbosity
        )

        # Set probabilty for P1
        p_val = Moecache["rinterpolator_log10P"].interpolate(
            [np.log10(options["M1"]), np.log10(options["P"])]
            [np.log10(options["M_1"]), np.log10(options["P"])]
        )[0]
        p_val = p_val / Moecache["P_integrals"][options["M1"]]
        p_val = p_val / Moecache["P_integrals"][options["M_1"]]
        prob_dict['P'] = p_val
        verbose_print(
            "\tM&S: Moe_de_Stefano_2017_pdf: Appended period (m={}, P={}) probability ({}) to the prob list ({})".format(
                options["M1"], options["P"], prob_dict['P'], prob_dict
                options["M_1"], options["P"], prob_dict['P'], prob_dict
            ),
            verbosity,
            _MS_VERBOSITY_LEVEL,
@@ -1951,11 +1945,11 @@ def Moe_de_Stefano_2017_pdf(options, verbosity=0):
        # we need to construct the q table for the given M1
        # subject to qmin = Mmin/M1

        if options.get("M2", None):
        if options.get("M_2", None):
            # Build the table for q
            primary_mass = options["M1"]
            secondary_mass = options["M2"]
            m_label = "M1"
            primary_mass = options["M_1"]
            secondary_mass = options["M_2"]
            m_label = "M_1"
            p_label = "P"

            # Construct the q table
@@ -1975,9 +1969,9 @@ def Moe_de_Stefano_2017_pdf(options, verbosity=0):
            prob_dict['q'] = q_prob
            verbose_print(
                "\tM&S: Moe_de_Stefano_2017_pdf: appended mass ratio (M={} P={} q={}) probability ({}) to the prob list ({}) ".format(
                    options["M1"],
                    options["M_1"],
                    options["P"],
                    options["M2"] / options["M1"],
                    options["M_2"] / options["M_1"],
                    prob_dict['q'],
                    prob_dict,
                ),
@@ -1997,19 +1991,19 @@ def Moe_de_Stefano_2017_pdf(options, verbosity=0):
            if not options['ecc']==None:
                # Calculate ecc integral or use cached value
                calc_e_integral(
                    options, "ecc_integrals", "rinterpolator_e", "M1", "P", verbosity
                    options, "ecc_integrals", "rinterpolator_e", "M_1", "P", verbosity
                )
                mass_period_string = "{}_{}".format(options["M1"], options["P"])
                mass_period_string = "{}_{}".format(options["M_1"], options["P"])

                # Set probabilty for ecc
                ecc_val = Moecache["rinterpolator_e"].interpolate(
                    [np.log10(options["M1"]), np.log10(options["P"]), options["ecc"]]
                    [np.log10(options["M_1"]), np.log10(options["P"]), options["ecc"]]
                )[0]
                ecc_val = ecc_val / Moecache["ecc_integrals"][mass_period_string]
                prob_dict['ecc'] = ecc_val
                verbose_print(
                    "\tM&S: Moe_de_Stefano_2017_pdf: Appended eccentricity (m={}, P={}, ecc={}) probability ({}) to the prob list ({})".format(
                        options["M1"], options["P"], options["ecc"], prob_dict['ecc'], prob_dict
                        options["M_1"], options["P"], options["ecc"], prob_dict['ecc'], prob_dict
                    ),
                    verbosity,
                    _MS_VERBOSITY_LEVEL,
@@ -2035,7 +2029,7 @@ def Moe_de_Stefano_2017_pdf(options, verbosity=0):

            # TODO: Is this a correct assumption?
            max_sep = 10.0 * options["sep"] * (1.0 + options["ecc"])
            min_P2 = calc_period_from_sep(options["M1+M2"], options["mmin"], max_sep)
            min_P2 = calc_period_from_sep(options["M_1+M_2"], options["mmin"], max_sep)

            if options["P2"] < min_P2:
                # period is too short : system is not hierarchical
@@ -2056,7 +2050,7 @@ def Moe_de_Stefano_2017_pdf(options, verbosity=0):
                # hence the separation between the outer star
                # and inner binary
                options["sep2"] = calc_sep_from_period(
                    options["M3"], options["M1+M2"], options["P2"]
                    options["M_3"], options["M_1+M_2"], options["P2"]
                )

                # Check for cached value of P integral or calculate
@@ -2065,19 +2059,19 @@ def Moe_de_Stefano_2017_pdf(options, verbosity=0):
                    min_P2,
                    "P2_integrals",
                    "rinterpolator_log10P",
                    "M1+M2",
                    "M_1+M_2",
                    verbosity,
                )

                # Add the probability
                p_val = Moecache["rinterpolator_log10P"].interpolate(
                    [np.log10(options["M1+M2"]), np.log10(options["P2"])]
                    [np.log10(options["M_1+M_2"]), np.log10(options["P2"])]
                )[0]
                p_val = p_val / Moecache["P2_integrals"][options["M1+M2"]]
                p_val = p_val / Moecache["P2_integrals"][options["M_1+M_2"]]
                prob_dict['P2'] = p_val
                verbose_print(
                    "\tM&S: Moe_de_Stefano_2017_pdf: Appended period2 (m1={} m2={}, P2={}) probability ({}) to the prob list ({})".format(
                        options["M1"], options["M2"], options["P2"], prob_dict['P2'], prob_dict
                        options["M_1"], options["M_2"], options["P2"], prob_dict['P2'], prob_dict
                    ),
                    verbosity,
                    _MS_VERBOSITY_LEVEL,
@@ -2093,9 +2087,9 @@ def Moe_de_Stefano_2017_pdf(options, verbosity=0):
                # subject to qmin = Mmin/(M1+M2)

                # Set the variables for the masses and their names
                primary_mass = options["M1+M2"]
                secondary_mass = options["M3"]
                m_label = "M1+M2"
                primary_mass = options["M_1+M_2"]
                secondary_mass = options["M_3"]
                m_label = "M_1+M_2"
                p_label = "P2"

                # Build q table
@@ -2112,9 +2106,9 @@ def Moe_de_Stefano_2017_pdf(options, verbosity=0):
                ].interpolate([secondary_mass / primary_mass])[0]
                prob_dict['q2'] = q2_val
                verbose_print(
                    "\tM&S: Moe_de_Stefano_2017_pdf: appended mass ratio (M1+M2={} M3={} P={} q={}) probability ({}) to the prob list ({}) ".format(
                        options["M1+M2"],
                        options["M3"],
                    "\tM&S: Moe_de_Stefano_2017_pdf: appended mass ratio (M_1+M_2={} M_3={} P={} q={}) probability ({}) to the prob list ({}) ".format(
                        options["M_1+M_2"],
                        options["M_3"],
                        options["P"],
                        secondary_mass / primary_mass,
                        prob_dict['q2'],
@@ -2142,7 +2136,7 @@ def Moe_de_Stefano_2017_pdf(options, verbosity=0):
                    # TODO: fix this here
                    max_sep3 = 0.2 * options["sep2"] * (1.0 + options["ecc2"])
                    max_per3 = calc_period_from_sep(
                        options["M1+M2"], options["mmin"], max_sep3
                        options["M_1+M_2"], options["mmin"], max_sep3
                    )

                    # Calculate P integral or use the cached value
@@ -2152,19 +2146,19 @@ def Moe_de_Stefano_2017_pdf(options, verbosity=0):
                        min_P2,
                        "P2_integrals",
                        "rinterpolator_log10P",
                        "M1+M2",
                        "M_1+M_2",
                        verbosity,
                    )

                    # Set probability
                    p_val = Moecache["rinterpolator_log10P"].interpolate(
                        [np.log10(options["M1+M2"]), np.log10(options["P2"])]
                        [np.log10(options["M_1+M_2"]), np.log10(options["P2"])]
                    )[0]
                    p_val = p_val / Moecache["P2_integrals"][options["M1+M2"]]
                    p_val = p_val / Moecache["P2_integrals"][options["M_1+M_2"]]
                    prob_dict['P3'] = p_val
                    verbose_print(
                        "\tM&S: Moe_de_Stefano_2017_pdf: Appended period2 (M=4) (m1={} m2={}, P2={}) probability ({}) to the prob list ({})".format(
                            options["M1"], options["M2"], options["P2"], prob_dict['P3'], prob_dict
                        "\tM&S: Moe_de_Stefano_2017_pdf: Appended period2 (M=4) (M_1={} M_2={}, P2={}) probability ({}) to the prob list ({})".format(
                            options["M_1"], options["M_2"], options["P2"], prob_dict['P3'], prob_dict
                        ),
                        verbosity,
                        _MS_VERBOSITY_LEVEL,
@@ -2181,9 +2175,9 @@ def Moe_de_Stefano_2017_pdf(options, verbosity=0):
                    # Make a table storing Moe's data for q distributions

                    # Build the table for q2
                    primary_mass = options["M1+M2"]
                    secondary_mass = options["M3"]
                    m_label = "M1+M2"
                    primary_mass = options["M_1+M_2"]
                    secondary_mass = options["M_3"]
                    m_label = "M_1+M_2"
                    p_label = "P2"

                    # Calculate new q table
@@ -2200,9 +2194,9 @@ def Moe_de_Stefano_2017_pdf(options, verbosity=0):
                    ].interpolate([secondary_mass / primary_mass])[0]
                    prob_dict['q3'] = q3_prob
                    verbose_print(
                        "\tM&S: Moe_de_Stefano_2017_pdf: appended mass ratio (M1+M2={} M3={} P={} q={}) probability ({}) to the prob list ({}) ".format(
                            options["M1+M2"],
                            options["M3"],
                        "\tM&S: Moe_de_Stefano_2017_pdf: appended mass ratio (M_1+M_2={} M_3={} P={} q={}) probability ({}) to the prob list ({}) ".format(
                            options["M_1+M_2"],
                            options["M_3"],
                            options["P"],
                            secondary_mass / primary_mass,
                            prob_dict['q3'],
@@ -2235,8 +2229,8 @@ def Moe_de_Stefano_2017_pdf(options, verbosity=0):
    # Some info
    if multiplicity == 1:
        verbose_print(
            "\tM&S: Moe_de_Stefano_2017_pdf: M1={} q=N/A log10P=N/A ({}): {} -> {}\n".format(
                options["M1"],
            "\tM&S: Moe_de_Stefano_2017_pdf: M_1={} q=N/A log10P=N/A ({}): {} -> {}\n".format(
                options["M_1"],
                len(prob_dict),
                str(prob_dict),
                prob_dict['total_probdens']
@@ -2246,9 +2240,9 @@ def Moe_de_Stefano_2017_pdf(options, verbosity=0):
        )
    elif multiplicity == 2:
        verbose_print(
            "\tM&S: Moe_de_Stefano_2017_pdf: M1={} q={} log10P={} ecc={} ({}): {} -> {}\n".format(
                options["M1"],
                options["M2"] / options["M1"] if options.get("M2", None) else "N/A",
            "\tM&S: Moe_de_Stefano_2017_pdf: M_1={} q={} log10P={} ecc={} ({}): {} -> {}\n".format(
                options["M_1"],
                options["M_2"] / options["M_1"] if options.get("M_2", None) else "N/A",
                np.log10(options["P"]),
                options['ecc'] if options.get("ecc", None) else "N/A",
                len(prob_dict),
@@ -2260,12 +2254,12 @@ def Moe_de_Stefano_2017_pdf(options, verbosity=0):
        )
    elif multiplicity == 3:
        verbose_print(
            "\tM&S: Moe_de_Stefano_2017_pdf: M1={} q={} log10P={} ecc={} M3={} log10P2={} ecc2={} ({}): {} -> {}".format(
                options["M1"],
                options["M2"] / options["M1"] if options.get("M2", None) else "N/A",
            "\tM&S: Moe_de_Stefano_2017_pdf: M_1={} q={} log10P={} ecc={} M_3={} log10P2={} ecc2={} ({}): {} -> {}".format(
                options["M_1"],
                options["M_2"] / options["M_1"] if options.get("M_2", None) else "N/A",
                np.log10(options["P"]),
                options["ecc"] if options.get("ecc", None) else "N/A",
                options["M3"],
                options["M_3"],
                np.log10(options["P2"]),
                options["ecc2"] if options.get("ecc2", None) else "N/A",
                len(prob_dict),
@@ -2277,15 +2271,15 @@ def Moe_de_Stefano_2017_pdf(options, verbosity=0):
        )
    elif multiplicity == 4:
        verbose_print(
            "M&S: Moe_de_Stefano_2017_pdf: M1={} q={} log10P={} ecc={} M3={} log10P2={} ecc2={} M4={} log10P3={} ecc3={} ({}) : {} -> {}".format(
                options["M1"],
                options["M2"] / options["M1"] if options.get("M2", None) else "N/A",
            "M&S: Moe_de_Stefano_2017_pdf: M_1={} q={} log10P={} ecc={} M_3={} log10P2={} ecc2={} M_4={} log10P3={} ecc3={} ({}) : {} -> {}".format(
                options["M_1"],
                options["M_2"] / options["M_1"] if options.get("M_2", None) else "N/A",
                np.log10(options["P"]),
                options['ecc'] if options.get("ecc", None) else "N/A",
                options["M3"],
                options["M_3"],
                np.log10(options["P2"]),
                options["ecc2"] if options.get("ecc2", None) else "N/A",
                options["M4"],
                options["M_4"],
                np.log10(options["P3"]),
                options["ecc3"] if options.get("ecc3", None) else "N/A",
                len(prob_dict), str(prob_dict), prob_dict['total_probdens']
+29 −16
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@ import tempfile
import copy
import inspect
import sys
import time
import types

from io import StringIO
from typing import Union, Any
@@ -169,8 +171,7 @@ def subtract_dicts(dict_1: dict, dict_2: dict) -> dict:
                    del new_dict[key]

            else:
                print(
                    "Error key: {} value: {} type: {} and key: {} value: {} type: {} are not of the same type and cannot be merged".format(
                msg = "Error key: {} value: {} type: {} and key: {} value: {} type: {} are not of the same type and cannot be merged".format(
                    key,
                    dict_1[key],
                    type(dict_1[key]),
@@ -178,8 +179,9 @@ def subtract_dicts(dict_1: dict, dict_2: dict) -> dict:
                    dict_2[key],
                    type(dict_2[key]),
                )
                )
                raise ValueError

                print(msg)
                raise ValueError(msg)

        # This is where the keys are the same
        else:
@@ -210,26 +212,37 @@ def subtract_dicts(dict_1: dict, dict_2: dict) -> dict:
    return new_dict


def get_moe_distefano_dataset(options):
def get_moe_distefano_dataset(options, verbosity=0):
    """
    Function to get the default moe and Distefano dataset or accept a userinput.
    """

    if not options.get("file", None):
        print("Using the default Moe and de Stefano 2017 datafile")
        verbose_print(
            "Using the default Moe and de Stefano 2017 datafile",
            verbosity,
            1,
        )

        json_data = copy.deepcopy(moe_distefano_data.moe_distefano_2017_data)

    else:
        if not os.path.isfile(options["file"]):
            print(
            verbose_print(
                "The provided 'file' Moe and de Stefano JSON file does not seem to exist at {}".format(
                    options["file"]
                ),
                verbosity,
                1,
            )
            )

            raise ValueError
        if not options["file"].endswith(".json"):
            print("Provided filename does not end with .json")
            verbose_print(
                "Provided filename is not a json file",
                verbosity,
                1,
            )

        else:
            # Read input data and Clean up the data if there are whitespaces around the keys
@@ -1893,7 +1906,7 @@ def binaryc_json_serializer(obj: Any) -> Any:
    Function objects will be turned into str representations of themselves

    Args:
        obj: obj being process
        obj: The object that might not be serializable

    Returns:
        Either string representation of object if the object is a function, or the object itself
+483 −358

File changed.

Preview size limit exceeded, changes collapsed.

+10 −8
Original line number Diff line number Diff line
@@ -11,8 +11,6 @@ There are several other functions in this module, mostly to generate help texts
With this its also possible to automatically generate a document containing all the setting names + descriptions. 

All the options starting with _ should not be changed by the user except when you really know what you're doing (which is probably hacking the code :P)

# TODO: add moe distefano
"""

import os
@@ -24,28 +22,24 @@ _MS_VERBOSITY_LEVEL = 5
_MS_VERBOSITY_INTERPOLATOR_LEVEL = 6
_MS_VERBOSITY_INTERPOLATOR_EXTRA_LEVEL = 7


# Options dict
grid_options_defaults_dict = {
    ##########################
    # general (or unordered..)
    ##########################
    "amt_cores": 1,  # total amount of cores used to evolve the population
    "binary": 0,  # FLag on whether the systems are binary systems or single systems.
    "parse_function": None,  # FUnction to parse the output with.
    "multiplicity_fraction_function": 0, # Which multiplicity fraction function to use. 0: None, 1: Arenou 2010, 2: Rhagavan 2010, 3: M&S 2017
    "tmp_dir": temp_dir(),  # Setting the temp dir of the program
    "_main_pid": -1,  # Placeholder for the main process id of the run.
    "combine_ensemble_with_thread_joining": True,  # Flag on whether to combine everything and return it to the user or if false: write it to data_dir/ensemble_output_{popuation_id}_{thread_id}.json
    # "output_dir":
    "_commandline_input": "",
    "log_runtime_systems": 0,  # whether to log the runtime of the systems (1 file per thread. stored in the tmp_dir)
    "_actually_evolve_system": True,  # Whether to actually evolve the systems of just act as if. for testing. used in _process_run_population_grid
    "max_queue_size": 1000,  # Maximum size of the system call queue. Can't be too big!
    "_set_ms_grid": False, # Whether the M&S grid has been loaded
    "max_queue_size": 1000,  # Maximum size of the system call queue.
    "run_zero_probability_system": True, # Whether to run the zero probability systems
    "_zero_prob_stars_skipped": 0,
    "ensemble_factor_in_probability_weighted_mass": False, # Whether to multiply the ensemble results by 1/probability_weighted_mass
    "multiplicity_fraction_function": 0, # Which multiplicity fraction function to use. 0: None, 1: Arenou 2010, 2: Rhagavan 2010, 3: M&S 2017
    ##########################
    # Execution log:
    ##########################
@@ -67,6 +61,12 @@ grid_options_defaults_dict = {
    ),  # TODO: make this more robust
    "_binary_c_dir": os.environ["BINARY_C"],
    ##########################
    # M&S internal settings
    ##########################
    "_loaded_ms_data": False, # Holds flag whether the M&S data is loaded into memory
    "_set_ms_grid": False, # Whether the M&S grid has been loaded
    "m&s_options": None, # Holds the M&S options.
    ##########################
    # Custom logging
    ##########################
    "C_auto_logging": None,  # Should contain a dictionary where the kes are they headers
@@ -489,6 +489,8 @@ grid_options_descriptions = {
    "_zero_prob_stars_skipped": "Internal counter to track how many systems are skipped because they have 0 probability",
    "ensemble_factor_in_probability_weighted_mass": "Flag to multiply all the ensemble results with 1/probability_weighted_mass",
    "multiplicity_fraction_function": "Which multiplicity fraction function to use. 0: None, 1: Arenou 2010, 2: Rhagavan 2010, 3: M&S 2017",
    "m&s_options": "Internal variable that holds the M&S options. Don't write to this your self",
    "_loaded_ms_data": "Internal variable storing whether the M&S data has been loaded into memory",
}

###
+12 −11
Original line number Diff line number Diff line
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# https://brendanhasz.github.io/2019/01/05/sphinx.html
"""
Configuration file for the Sphinx documentation builder.

This file only contains a selection of the most common options. For a full
list see the documentation:
https://www.sphinx-doc.org/en/master/usage/configuration.html
https://brendanhasz.github.io/2019/01/05/sphinx.html
"""

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#

import os
import sys

@@ -19,10 +22,6 @@ import sphinx_rtd_theme

# Include paths for python code
sys.path.insert(0, os.path.abspath("."))
# sys.path.insert(0, os.path.abspath("../../binarycpython"))
# # sys.path.insert(0, os.path.abspath('../../examples'))
# sys.path.insert(0, os.path.abspath("../../"))
# sys.path.insert(0, os.path.abspath("../../binarycpython/utils"))
sys.path.insert(0, os.path.join(os.getenv("BINARY_C"), "src/API/"))

# include paths for c code
@@ -128,3 +127,5 @@ print("Done")
print("Generating grid_options_descriptions.rst")
write_grid_options_to_rst_file("grid_options_descriptions.rst")
print("Done")

# Add