From 89c2cd1423e422e22e42790a5cd9dd3b58f01589 Mon Sep 17 00:00:00 2001 From: David Hendriks <davidhendriks93@gmail.com> Date: Sat, 12 Jun 2021 00:51:26 +0100 Subject: [PATCH] fixed the 0 prob tinhgs --- binarycpython/utils/grid.py | 10 +++++++++- binarycpython/utils/grid_options_defaults.py | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/binarycpython/utils/grid.py b/binarycpython/utils/grid.py index 956d232eb..fff045f31 100644 --- a/binarycpython/utils/grid.py +++ b/binarycpython/utils/grid.py @@ -753,6 +753,7 @@ class Population: "total_probability_weighted_mass_run": self.grid_options[ "_total_probability_weighted_mass_run" ], + "zero_prob_stars_skipped": self.grid_options['_zero_prob_stars_skipped'] } ## @@ -1014,6 +1015,7 @@ class Population: self.grid_options[ "_total_probability_weighted_mass_run" ] = combined_output_dict["_total_probability_weighted_mass_run"] + self.grid_options['_zero_prob_stars_skipped'] = combined_output_dict['_zero_prob_stars_skipped'] def _evolve_system_mp(self, full_system_dict): """ @@ -1119,6 +1121,7 @@ class Population: number_of_systems_run = ( 0 # counter for the actual amt of systems this thread ran ) + zero_prob_stars_skipped = 0 total_time_calling_binary_c = 0 @@ -1215,6 +1218,7 @@ class Population: if not self.grid_options["run_zero_probability_system"]: if full_system_dict['probability'] == 0: run_system = False + zero_prob_stars_skipped += 1 if run_system: # Evolve the system @@ -1347,12 +1351,13 @@ class Population: "_count": number_of_systems_run, "_total_mass_run": total_mass_run, "_total_probability_weighted_mass_run": total_probability_weighted_mass_run, + "_zero_prob_stars_skipped": zero_prob_stars_skipped, } end_process_time = datetime.datetime.now() verbose_print( - "Process {} finished:\n\tgenerator started at {}, done at {} (total: {}s of which {}s interfacing with binary_c).\n\tRan {} systems with a total probability of {}.\n\tThis thread had {} failing systems with a total probability of {}".format( + "Process {} finished:\n\tgenerator started at {}, done at {} (total: {}s of which {}s interfacing with binary_c).\n\tRan {} systems with a total probability of {}.\n\tThis thread had {} failing systems with a total probability of {}.\n\tSkipped a total of {} systems because they had 0 probability".format( ID, start_process_time.isoformat(), end_process_time.isoformat(), @@ -1362,6 +1367,8 @@ class Population: probability_of_systems_run, self.grid_options["_failed_count"], self.grid_options["_failed_prob"], + zero_prob_stars_skipped, + ), self.grid_options["verbosity"], 0, @@ -1381,6 +1388,7 @@ class Population: "failed_system_error_codes": self.grid_options[ "_failed_systems_error_codes" ], + "zero_prob_stars_skipped": zero_prob_stars_skipped, } with open( os.path.join( diff --git a/binarycpython/utils/grid_options_defaults.py b/binarycpython/utils/grid_options_defaults.py index f0f640669..49f5c0b28 100644 --- a/binarycpython/utils/grid_options_defaults.py +++ b/binarycpython/utils/grid_options_defaults.py @@ -42,6 +42,7 @@ grid_options_defaults_dict = { "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 "run_zero_probability_system": True, # Whether to run the zero probability systems + "_zero_prob_stars_skipped": 0, ########################## # Execution log: ########################## @@ -482,6 +483,7 @@ grid_options_descriptions = { "max_queue_size": "Maximum size of the queue that is used to feed the processes. Don't make this too big! Default: 1000. Input: int", "_set_ms_grid": "Internal flag whether the M&S grid has been loaded", "run_zero_probability_system": "Whether to run the zero probability systems. Default: True. Input: boolean", + "_zero_prob_stars_skipped": "Internal counter to track how many systems are skipped because they have 0 probability" } ### -- GitLab