Skip to content
Snippets Groups Projects
Commit 0df3b40d authored by Izzard, Robert Dr (Maths & Physics)'s avatar Izzard, Robert Dr (Maths & Physics)
Browse files

allow options to be passed to the IMF

parent 5ed97c87
No related branches found
No related tags found
No related merge requests found
......@@ -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(
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment