New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CPL added #159
CPL added #159
Conversation
@anastasia-tsvetkova you will need to run the script in /scripts/ python generate_test_data.py and move the newly created table to astromodels/data and update that table in the git |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the addition. However, I'm curious if it is not easier to compute Ep after a fit via error propagation. This parameterization introduces functional correlations.
@@ -343,6 +343,83 @@ def evaluate(self, x, K, piv, index, xc): | |||
|
|||
return result * unit_ | |||
|
|||
|
|||
class CPL(Function1D, metaclass=FunctionMeta): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of CPL could be confusing as there is already a cutoff power law function. Moreover, we typically spell out the function name to be clear for users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed: CPL -> Cutoff_powerlaw_Ep
|
||
A power law multiplied by an exponential cutoff parametrized via Ep | ||
|
||
latex : $ K~\frac{x}{piv}^{index}~\exp{-x/xp} $ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this the correct formula?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, thanks, fixed
unit_ = 1.0 | ||
K_, piv_, x_, index_, xp_ = K, piv, x, index, xp | ||
|
||
result = nb_func.cplaw_eval(x_, K_, xp_, index_, piv_) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a new numba function cpp_eval
created but it is not called here. However, there is really no need as you can write xc = xp (2+index) and pass this to cplaw_eval
without the need for extra code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -67,6 +67,20 @@ def cplaw_eval(x, K, xc, index, piv): | |||
return out | |||
|
|||
|
|||
@nb.njit(fastmath=True, cache=True) | |||
def cpl_eval(x, K, xp, index, piv): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleted
Cutoff PL parameterized via Ep added