diff --git a/binarycpython/utils/grid.py b/binarycpython/utils/grid.py index 38ed8e0924c87b67499da09d4394cb4ed8ee03fd..9cbb6872a91c2a7235b75a98032991192bd188ab 100644 --- a/binarycpython/utils/grid.py +++ b/binarycpython/utils/grid.py @@ -1802,7 +1802,7 @@ class Population: self._dry_run() print( - "Total starcount for this run will be: {} with a total probability of ".format( + "Total starcount for this run will be: {} with a total probability of {}".format( self.grid_options["_total_starcount"], self.grid_options['_probtot'] ) ) @@ -2142,6 +2142,16 @@ class Population: # Add some white line code_string += indent * (depth + 1) + "\n" + # # Add debugging: + # if grid_variable['name']=='q': + # code_string += ( + # indent * (depth + 1) + # + 'print("sampling:", sampled_values_{}, M_1)'.format( + # grid_variable["name"], grid_variable["name"] + # ) + # + "\n" + # ) + ##############3 # Add phasevol check: code_string += ( @@ -2150,10 +2160,12 @@ class Population: + "\n" ) + # TODO: We might actually want to add the starcount and probability to the totals regardless. + # n that case we need another local variable which will prevent it from being run but will track those parameters # Add phasevol check action: code_string += ( indent * (depth + 2) - + 'print("Grid generator: phasevol_{} <= 0!")'.format( + + 'print("Grid generator: phasevol_{} <= 0! Skipping current sample.")'.format( grid_variable["name"] ) + "\n" @@ -3799,7 +3811,7 @@ class Population: qmin={}/M_1 qmax=maximum_mass_ratio_for_RLOF(M_1, orbital_period) """.format( - self.grid_options['m&s_options'].get("Mmin", 0.07) + self.grid_options['m&s_options']["Mmin"] ), ) # TODO: change the maximum_mass_ratio_for_RLOF @@ -3811,7 +3823,7 @@ qmax=maximum_mass_ratio_for_RLOF(M_1, orbital_period) valuerange=[ self.grid_options['m&s_options']["ranges"]["q"][0] if self.grid_options['m&s_options'].get("ranges", {}).get("q", None) - else "options.get('Mmin', 0.07)/M_1", + else "options['Mmin']/M_1", self.grid_options['m&s_options']["ranges"]["q"][1] if self.grid_options['m&s_options'].get("ranges", {}).get("q", None) else "qmax", @@ -3827,7 +3839,7 @@ sep = calc_sep_from_period(M_1, M_2, orbital_period) spacingfunc="const({}, {}, {})".format( self.grid_options['m&s_options']["ranges"]["q"][0] if self.grid_options['m&s_options'].get("ranges", {}).get("q", [None, None])[0] - else "{}/M_1".format(self.grid_options['m&s_options'].get("Mmin", 0.07)), + else "{}/M_1".format(self.grid_options['m&s_options']["Mmin"]), self.grid_options['m&s_options']["ranges"]["q"][1] if self.grid_options['m&s_options'].get("ranges", {}).get("q", [None, None])[1] else "qmax", @@ -3883,7 +3895,7 @@ sep = calc_sep_from_period(M_1, M_2, orbital_period) q2min={}/(M_1+M_2) q2max=maximum_mass_ratio_for_RLOF(M_1+M_2, orbital_period_triple) """.format( - self.grid_options['m&s_options'].get("Mmin", 0.07) + self.grid_options['m&s_options']["Mmin"] ), ) @@ -3896,7 +3908,7 @@ q2max=maximum_mass_ratio_for_RLOF(M_1+M_2, orbital_period_triple) valuerange=[ self.grid_options['m&s_options']["ranges"]["q"][0] if self.grid_options['m&s_options'].get("ranges", {}).get("q", None) - else "options.get('Mmin', 0.07)/(M_1+M_2)", + else "options['Mmin']/(M_1+M_2)", self.grid_options['m&s_options']["ranges"]["q"][1] if self.grid_options['m&s_options'].get("ranges", {}).get("q", None) else "q2max", @@ -3913,7 +3925,7 @@ eccentricity2=0 spacingfunc="const({}, {}, {})".format( self.grid_options['m&s_options']["ranges"]["q"][0] if self.grid_options['m&s_options'].get("ranges", {}).get("q", None) - else "options.get('Mmin', 0.07)/(M_1+M_2)", + else "options['Mmin']/(M_1+M_2)", self.grid_options['m&s_options']["ranges"]["q"][1] if self.grid_options['m&s_options'].get("ranges", {}).get("q", None) else "q2max", @@ -3968,7 +3980,7 @@ eccentricity2=0 q3min={}/(M_3) q3max=maximum_mass_ratio_for_RLOF(M_3, orbital_period_quadruple) """.format( - self.grid_options['m&s_options'].get("Mmin", 0.07) + self.grid_options['m&s_options']["Mmin"] ), ) @@ -3980,7 +3992,7 @@ q3max=maximum_mass_ratio_for_RLOF(M_3, orbital_period_quadruple) valuerange=[ self.grid_options['m&s_options']["ranges"]["q"][0] if self.grid_options['m&s_options'].get("ranges", {}).get("q", None) - else "options.get('Mmin', 0.07)/(M_3)", + else "options['Mmin']/(M_3)", self.grid_options['m&s_options']["ranges"]["q"][1] if self.grid_options['m&s_options'].get("ranges", {}).get("q", None) else "q3max", @@ -3997,7 +4009,7 @@ eccentricity3=0 spacingfunc="const({}, {}, {})".format( self.grid_options['m&s_options']["ranges"]["q"][0] if self.grid_options['m&s_options'].get("ranges", {}).get("q", None) - else "options.get('Mmin', 0.07)/(M_3)", + else "options['Mmin']/(M_3)", self.grid_options['m&s_options']["ranges"]["q"][1] if self.grid_options['m&s_options'].get("ranges", {}).get("q", None) else "q3max", diff --git a/binarycpython/utils/grid_options_defaults.py b/binarycpython/utils/grid_options_defaults.py index 9dbcdb705936f0f2776eaf8d8eed9afd2f2e10b7..00b3e0d07b42c91437b2b9b0184b1825c8063ed4 100644 --- a/binarycpython/utils/grid_options_defaults.py +++ b/binarycpython/utils/grid_options_defaults.py @@ -501,6 +501,9 @@ grid_options_descriptions = { ### # +MIN_MASS_BINARY_C = float(return_binary_c_version_info(parsed=True)['macros']['BINARY_C_MINIMUM_STELLAR_MASS']) + + # Default options for the Moe & di Stefano grid moe_di_stefano_default_options = { "resolutions": { @@ -524,7 +527,7 @@ moe_di_stefano_default_options = { "ranges": { # stellar masses (Msun) "M": [ - 0.08, # 0.08 is a tad bit above the minimum mass. Don't sample at 0.07, otherwise the first row of q values will have a phasevol of 0. Anything higher is fine. + MIN_MASS_BINARY_C*1.05, # 0.08 is a tad bit above the minimum mass. Don't sample at 0.07, otherwise the first row of q values will have a phasevol of 0. Anything higher is fine. 80.0, # (rather arbitrary) upper mass cutoff ], "q": [ @@ -535,7 +538,7 @@ moe_di_stefano_default_options = { "ecc": [0.0, 0.99], }, # minimum stellar mass - "Mmin": float(return_binary_c_version_info(parsed=True)['macros']['BINARY_C_MINIMUM_STELLAR_MASS']), # We take the value that binary_c has set as the default + "Mmin": MIN_MASS_BINARY_C, # We take the value that binary_c has set as the default # multiplicity model (as a function of log10M1) #