From 506e4fa131caa9047d3be04828e470ce90926bdf Mon Sep 17 00:00:00 2001
From: David Hendriks <davidhendriks93@gmail.com>
Date: Wed, 28 Jul 2021 12:36:24 +0100
Subject: [PATCH] updated dry run functionality

---
 binarycpython/utils/grid.py | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/binarycpython/utils/grid.py b/binarycpython/utils/grid.py
index 3d3e71fda..b8553a339 100644
--- a/binarycpython/utils/grid.py
+++ b/binarycpython/utils/grid.py
@@ -1637,20 +1637,20 @@ class Population:
                 raise ValueError
 
             # Set up the grid code with a dry run option to see total probability
-            self._generate_grid_code(dry_run=True)
+            if self.grid_options['do_dry_run']:
+                self._generate_grid_code(dry_run=True)
 
-            # Load the grid code
-            self._load_grid_function()
+                # Load the grid code
+                self._load_grid_function()
 
-            if self.grid_options['do_dry_run']:
                 # Do a dry run
                 self._dry_run()
 
-            print(
-                "Total starcount for this run will be: {}".format(
-                    self.grid_options["_total_starcount"]
+                print(
+                    "Total starcount for this run will be: {}".format(
+                        self.grid_options["_total_starcount"]
+                    )
                 )
-            )
 
             #######################
             # Reset values and prepare the grid function
@@ -2308,13 +2308,10 @@ class Population:
 
         if not dry_run:
             # Handling of what is returned, or what is not.
-            # TODO: think of whether this is a good method
-            # code_string += indent * (depth + 2) + "if (self.grid_options['multiplicity'] >= 2): print('phasevol_q: ',phasevol_q); print('phasevol_log10per: ',phasevol_log10per);\n"
             code_string += indent * (depth + 2) + "yield(parameter_dict)\n"
 
         # If its a dry run, dont do anything with it
         else:
-            # code_string += indent * (depth + 2) + "if (self.grid_options['multiplicity'] >= 2): print(phasevol_q)\n"
             code_string += indent * (depth + 2) + "pass\n"
 
         code_string += indent * (depth + 1) + "#" * 40 + "\n"
-- 
GitLab