diff --git a/binarycpython/utils/distribution_functions.py b/binarycpython/utils/distribution_functions.py index 90621dd60bee712beba545e4e7248419da9ccd81..56799098c6031e31ce49edc674d86b5f920f5277 100644 --- a/binarycpython/utils/distribution_functions.py +++ b/binarycpython/utils/distribution_functions.py @@ -1732,7 +1732,7 @@ class distribution_functions(): return prob_dict - def Moe_di_Stefano_2017_pdf(self,options, verbosity=0): + def Moe_di_Stefano_2017_pdf(self, options, verbosity=0): """ Moe & diStefano function to calculate the probability density. @@ -1744,6 +1744,8 @@ class distribution_functions(): mmin => minimum allowed stellar mass (default 0.07) mmax => maximum allowed stellar mass (default 80.0) + + M1 options => options passed to the IMF function Kroupa2001() """ verbose_print( @@ -1805,8 +1807,11 @@ class distribution_functions(): # TODO: Create an n-part-powerlaw method that can have breakpoints and slopes. I'm using a three-part power law now. # TODO: is this actually the correct way? putting the M1 in there? Do we sample in log space? + if "M1 options" in options: + M1_probability = self.Kroupa2001(m=options["M_1"],newopts=options["M1 options"]) * options["M_1"] + else: + M1_probability = self.Kroupa2001(options["M_1"]) * options["M_1"] - M1_probability = self.Kroupa2001(options["M_1"]) * options["M_1"] prob_dict["M_1"] = M1_probability verbose_print( diff --git a/binarycpython/utils/spacing_functions.py b/binarycpython/utils/spacing_functions.py index 2525d5c3a0d7f75b02a768c47068c8bb7b5d4c13..392efbe65e744947e4e41ca4a0dedee912a737ff 100644 --- a/binarycpython/utils/spacing_functions.py +++ b/binarycpython/utils/spacing_functions.py @@ -335,24 +335,18 @@ class spacing_functions(): return func(*args, **kwargs) return wrapped - print("No brackets",cache.memoize) + #print("No brackets",cache.memoize) # <bound method Cache.memoize of <diskcache.core.Cache object at 0x14a83739d2e0>> - print("brackets",cache.memoize()) + #print("brackets",cache.memoize()) # <function Cache.memoize.<locals>.decorator at 0x14a8373f6d30> if cache is not None: - try: - eval('cache.memoize') - print("could not eval ()") - use_brackets = False - except: - print("could eval ()") - use_brackets = True # brackets: works on 3.9 - # no brackets : works on 3.8 + # no brackets : works on 3.8 ? brackets ALSO seem to work # - # brackets are correct! http://www.grantjenks.com/docs/diskcache/tutorial.html + # indeed, brackets are correct! + # http://www.grantjenks.com/docs/diskcache/tutorial.html __decorator = cache.memoize() else: __decorator = __dummy_decorator