Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
binary_c-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Izzard, Robert Dr (Maths & Physics)
binary_c-python
Commits
0df3b40d
Commit
0df3b40d
authored
3 years ago
by
Izzard, Robert Dr (Maths & Physics)
Browse files
Options
Downloads
Patches
Plain Diff
allow options to be passed to the IMF
parent
5ed97c87
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
binarycpython/utils/distribution_functions.py
+7
-2
7 additions, 2 deletions
binarycpython/utils/distribution_functions.py
binarycpython/utils/spacing_functions.py
+5
-11
5 additions, 11 deletions
binarycpython/utils/spacing_functions.py
with
12 additions
and
13 deletions
binarycpython/utils/distribution_functions.py
+
7
−
2
View file @
0df3b40d
...
...
@@ -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
(
...
...
This diff is collapsed.
Click to expand it.
binarycpython/utils/spacing_functions.py
+
5
−
11
View file @
0df3b40d
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment