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

Fixed tests and bug that was left after renaming the dictionary where ensemble results get stored

parent b1fb5969
No related branches found
No related tags found
No related merge requests found
......@@ -798,12 +798,12 @@ class test_grid_evolve(unittest.TestCase):
analytics = test_pop.evolve()
self.assertTrue(isinstance(test_pop.grid_options["ensemble_results"], dict))
self.assertNotEqual(test_pop.grid_options["ensemble_results"], {})
self.assertTrue(isinstance(test_pop.grid_ensemble_results['ensemble'], dict))
self.assertNotEqual(test_pop.grid_ensemble_results['ensemble'], {})
self.assertIn("number_counts", test_pop.grid_options["ensemble_results"])
self.assertIn("number_counts", test_pop.grid_ensemble_results['ensemble'])
self.assertNotEqual(
test_pop.grid_options["ensemble_results"]["number_counts"], {}
test_pop.grid_ensemble_results['ensemble']["number_counts"], {}
)
def test_grid_evolve_2_threads_with_ensemble_comparing_two_methods(self):
......@@ -850,7 +850,7 @@ class test_grid_evolve(unittest.TestCase):
)
analytics_1 = test_pop_1.evolve()
ensemble_output_1 = test_pop_1.grid_options["ensemble_results"]
ensemble_output_1 = test_pop_1.grid_ensemble_results
# second
test_pop_2 = Population()
......@@ -911,18 +911,17 @@ class test_grid_evolve(unittest.TestCase):
ensemble_output_2 = merge_dicts(ensemble_output_2, ensemble_json)
for key in ensemble_output_1["number_counts"]["stellar_type"]["0"]:
for key in ensemble_output_1['ensemble']["number_counts"]["stellar_type"]["0"]:
self.assertIn(key, ensemble_output_2["number_counts"]["stellar_type"]["0"])
# compare values
self.assertLess(
np.abs(
ensemble_output_1["number_counts"]["stellar_type"]["0"][key]
ensemble_output_1['ensemble']["number_counts"]["stellar_type"]["0"][key]
- ensemble_output_2["number_counts"]["stellar_type"]["0"][key]
),
1e-8,
)
if __name__ == "__main__":
unittest.main()
......@@ -86,8 +86,6 @@ grid_options_defaults_dict = {
"_probtot": 0, # total probability
"weight": 1.0, # weighting for the probability
"repeat": 1, # number of times to repeat each system (probability is adjusted to be 1/repeat)
"results": {}, # dict to store the results. Every process fills this on its own and then it will be joined later
"ensemble_results": {}, # Dict to store the ensemble results
"_start_time_evolution": 0, # Start time of the grid
"_end_time_evolution": 0, # end time of the grid
"_errors_found": False, # Flag whether there are any errors from binary_c
......@@ -437,7 +435,6 @@ grid_options_descriptions = {
"_errors_found": "Variable storing a boolean flag whether errors by binary_c are encountered.",
"_errors_exceeded": "Variable storing a boolean flag whether the amount of errors was higher than the set threshold (failed_systems_threshold). If True, then the commandline arguments of the failing systems will not be stored in the failed_system_log files.",
"source_file_filename": "Variable containing the source file containing lines of binary_c commandline calls. These all have to start with binary_c.", # TODO: Expand
"results": "Dictionary in which the user can place their results. This dictionary gets merged at the end of a mulitprocessing simulation.",
"C_auto_logging": "Dictionary containing parameters to be logged by binary_c. The structure of this dictionary is as follows: the key is used as the headline which the user can then catch. The value at that key is a list of binary_c system parameters (like star[0].mass)",
"C_logging_code": "Variable to store the exact code that is used for the custom_logging. In this way the user can do more complex logging, as well as putting these logging strings in files.",
"_failed_count": "Variable storing the amount of failed systems.",
......@@ -465,7 +462,6 @@ grid_options_descriptions = {
"repeat": "Factor of how many times a system should be repeated. Consider the evolution splitting binary_c argument for supernovae kick repeating.", # TODO: make sure this is used.
"evolution_type": "Variable containing the type of evolution used of the grid. Multiprocessing or linear processing",
"combine_ensemble_with_thread_joining": "BOolean 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",
"ensemble_results": "Dictinary that stores the ensemble results if combine_ensemble_with_thread_joining==True",
"log_runtime_systems": "Whether to log the runtime of the systems . Each systems run by the thread is logged to a file and is stored in the tmp_dir. (1 file per thread). Don't use this if you are planning to run alot of systems. This is mostly for debugging and finding systems that take long to run. Integer, default = 0. if value is 1 then the systems are logged",
}
......
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