Skip to content
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

Fix/b value testing #178

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Fix/b value testing #178

wants to merge 4 commits into from

Conversation

aronsho
Copy link
Collaborator

@aronsho aronsho commented Aug 28, 2024

Make the tests for the b-value estimates more reliable

@@ -94,129 +96,107 @@ def test_estimate_b(
assert w[-1].category == UserWarning


def magnitudes(b: float):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe name differently? load_magnitudes?

[
(1000000, 1.2, 3, 0, "b_value", 0.005),
(1000000, np.log(10), 3, 0.1, "beta", 0.01),
(1, magnitudes(1), 0, 0.1, 0.002, "b_value"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use exact b-values calculated with the function as it is now, assuming it is now correct.

n, b, mc, delta_m, b_parameter=b_parameter
)
mags = bin_to_precision(mags, delta_m)
mags = mags[mags >= mc - delta_m / 2]
b_estimate = estimate_b_classic(mags, mc, delta_m, b_parameter=b_parameter)

assert abs(b - b_estimate) / b <= precision
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then this becomes almost equal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants