diff --git a/binarycpython/tests/test_custom_logging.py b/binarycpython/tests/test_custom_logging.py index 05792732464a1672bd6d9304ae8d64084ab779d9..f15ca184fab13c1128f5776589f2bed6e5ca602c 100644 --- a/binarycpython/tests/test_custom_logging.py +++ b/binarycpython/tests/test_custom_logging.py @@ -18,7 +18,7 @@ class test_custom_logging(unittest.TestCase): def test_autogen_C_logging_code(self): with Capturing() as output: self._test_autogen_C_logging_code() - print("\n".join(output)) + # print("\n".join(output)) def _test_autogen_C_logging_code(self): """ @@ -51,7 +51,7 @@ class test_custom_logging(unittest.TestCase): def test_binary_c_log_code(self): with Capturing() as output: self._test_binary_c_log_code() - print("\n".join(output)) + # print("\n".join(output)) def _test_binary_c_log_code(self): """ @@ -74,7 +74,7 @@ class test_custom_logging(unittest.TestCase): def test_binary_c_write_log_code(self): with Capturing() as output: self._test_binary_c_write_log_code() - print("\n".join(output)) + # print("\n".join(output)) def _test_binary_c_write_log_code(self): """ @@ -103,7 +103,7 @@ class test_custom_logging(unittest.TestCase): def test_from_binary_c_config(self): with Capturing() as output: self._test_from_binary_c_config() - print("\n".join(output)) + # print("\n".join(output)) def _test_from_binary_c_config(self): """ @@ -132,7 +132,7 @@ class test_custom_logging(unittest.TestCase): def test_return_compilation_dict(self): with Capturing() as output: self._test_return_compilation_dict() - print("\n".join(output)) + # print("\n".join(output)) def _test_return_compilation_dict(self): """ @@ -153,7 +153,7 @@ class test_custom_logging(unittest.TestCase): def test_create_and_load_logging_function(self): with Capturing() as output: self._test_create_and_load_logging_function() - print("\n".join(output)) + # print("\n".join(output)) def _test_create_and_load_logging_function(self): """ diff --git a/binarycpython/tests/test_distributions.py b/binarycpython/tests/test_distributions.py index 1b5c1d836e2f8fc4f24048b9b20731cdc7728896..2e3e7c26cf83f2c443768d4e97917740534db6df 100644 --- a/binarycpython/tests/test_distributions.py +++ b/binarycpython/tests/test_distributions.py @@ -320,22 +320,6 @@ class TestDistributions(unittest.TestCase): np.abs(python_results[i] - perl_results[i]), self.tolerance, msg=msg ) - # # for m=0.5 - # m = 0.5 - # self.assertLess( - # np.abs(imf_chabrier2003(m) - 0.581457346702825), - # self.tolerance, - # msg="Difference is bigger than the tolerance. Input mass = {}".format(m), - # ) - - # # For m = 2 - # m = 2 - # self.assertLess( - # np.abs(imf_chabrier2003(m) - 0.581457346702825), - # self.tolerance, - # msg="Difference is bigger than the tolerance. Input mass = {}".format(m), - # ) - def test_duquennoy1991(self): with Capturing() as output: self._test_duquennoy1991() diff --git a/binarycpython/utils/custom_logging_functions.py b/binarycpython/utils/custom_logging_functions.py index c50562b911f1c8bee7645b2e11b97a10557d8f83..0415f018ce21c318da3f0130a0d2cdf9f586f08b 100644 --- a/binarycpython/utils/custom_logging_functions.py +++ b/binarycpython/utils/custom_logging_functions.py @@ -138,6 +138,7 @@ def binary_c_log_code(code: str, verbose: int = 0) -> str: #undef MIN #include \"binary_c.h\" #include \"RLOF/RLOF_prototypes.h\" +#include \"nucsyn/nucsyn_prototypes.h\" // add visibility __attribute__ ((visibility ("default"))) to it void binary_c_API_function custom_output_function(struct stardata_t * stardata); @@ -204,6 +205,7 @@ def from_binary_c_config(config_file: str, flag: str) -> str: # convert and chop off newline res = res.decode("utf-8").rstrip() + print(res) return res diff --git a/binarycpython/utils/functions.py b/binarycpython/utils/functions.py index 61941dbbecb8ea6712ade870a0698b0aacd82d93..7fb0131e691e585a676459969bacf209c50aac00 100644 --- a/binarycpython/utils/functions.py +++ b/binarycpython/utils/functions.py @@ -322,6 +322,39 @@ def parse_binary_c_version_info(version_info_string: str) -> dict: splitted = version_info_string.strip().splitlines() cleaned = set([el.strip() for el in splitted if not el == ""]) + ########################## + # Network: + # Split off all the networks and parse the info. + + networks = set([el for el in cleaned if el.startswith("Network ")]) + cleaned = cleaned - networks + + networks_dict = {} + for el in networks: + network_dict = {} + split_info = el.split("Network ")[-1].strip().split("==") + + network_number = int(split_info[0]) + network_dict['network_number'] = network_number + + network_info_split = split_info[1].split(" is ") + + shortname = network_info_split[0].strip() + network_dict['shortname'] = shortname + + if not network_info_split[1].strip().startswith(":"): + network_split_info_extra = network_info_split[1].strip().split(":") + + longname = network_split_info_extra[0].strip() + network_dict['longname'] = longname + + implementation = network_split_info_extra[1].strip().replace("implemented in", "") + if implementation: + network_dict['implemented_in'] = implementation.strip().split() + + networks_dict[network_number] = copy.deepcopy(network_dict) + version_info_dict["networks"] = networks_dict if networks_dict else None + ########################## # Isotopes: # Split off @@ -401,6 +434,7 @@ def parse_binary_c_version_info(version_info_string: str) -> dict: "MACRO": str, "INT": int, "LONG_INT": int, + "UINT": int } macros_dict = {} @@ -413,6 +447,7 @@ def parse_binary_c_version_info(version_info_string: str) -> dict: param_value = " is ".join(new_split[1:]) # Sometimes the macros have extra information behind it. Needs an update in outputting by binary_c try: + print(param_name, param_type, param_value) macros_dict[param_name] = param_type_dict[param_type](param_value) except ValueError: macros_dict[param_name] = str(param_value)