From 122d53c671a1d3027b4b1c0a4ddc89729fae0683 Mon Sep 17 00:00:00 2001
From: dh00601 <dh00601@surrey.ac.uk>
Date: Thu, 7 Oct 2021 20:26:35 +0100
Subject: [PATCH] updated multiplicity fraction function to be normalized. next
 i need to the add option for manual fraction

---
 binarycpython/utils/grid.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/binarycpython/utils/grid.py b/binarycpython/utils/grid.py
index 9cbb6872a..fa949ec7b 100644
--- a/binarycpython/utils/grid.py
+++ b/binarycpython/utils/grid.py
@@ -92,6 +92,7 @@ from binarycpython.utils.distribution_functions import (
     Arenou2010_binary_fraction,
     raghavan2010_binary_fraction,
     Moe_di_Stefano_2017_multiplicity_fractions,
+    normalize_dict,
 )
 
 from binarycpython import _binary_c_bindings
@@ -4127,6 +4128,8 @@ eccentricity3=0
         Makes use of the self.bse_options['multiplicity'] value. If its not set, it will raise an error
 
         grid_options['multiplicity_fraction_function'] will be checked for the choice
+    
+        TODO: add option to put a manual binary fraction in here (solve via negative numbers being the functions)
         """
 
         # Just return 1 if no option has been chosen
@@ -4206,6 +4209,9 @@ eccentricity3=0
             msg = "Chosen value for the multiplicity fraction function is not known."
             raise ValueError(msg)
 
+        # To make sure we normalize the dictionary
+        multiplicity_fraction_dict = normalize_dict(multiplicity_fraction_dict, verbosity=self.grid_options["verbosity"])
+
         verbose_print(
             "Multiplicity: {} multiplicity_fraction: {}".format(system_dict['multiplicity'], multiplicity_fraction_dict[system_dict['multiplicity']]),
             self.grid_options["verbosity"],
-- 
GitLab