Skip to content
Snippets Groups Projects
Commit 741a4e03 authored by David Hendriks's avatar David Hendriks
Browse files

Working on the errors generated by syncing with master

parent aaf2f59d
No related branches found
No related tags found
No related merge requests found
......@@ -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):
"""
......
......@@ -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()
......
......@@ -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
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment