-
Notifications
You must be signed in to change notification settings - Fork 30
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
Replace instances of 4pi*1e-7
with scipy.constants.mu_0
#1513
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1513 +/- ##
=======================================
Coverage 95.69% 95.69%
=======================================
Files 101 101
Lines 25569 25569
=======================================
Hits 24467 24467
Misses 1102 1102
|
| benchmark_name | dt(%) | dt(s) | t_new(s) | t_old(s) |
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
test_build_transform_fft_lowres | +3.22 +/- 6.82 | +1.78e-02 +/- 3.78e-02 | 5.72e-01 +/- 3.1e-02 | 5.54e-01 +/- 2.1e-02 |
test_equilibrium_init_medres | +1.14 +/- 3.05 | +5.03e-02 +/- 1.34e-01 | 4.45e+00 +/- 1.2e-01 | 4.40e+00 +/- 5.1e-02 |
test_equilibrium_init_highres | +0.56 +/- 2.56 | +3.15e-02 +/- 1.45e-01 | 5.68e+00 +/- 1.2e-01 | 5.65e+00 +/- 8.7e-02 |
test_objective_compile_dshape_current | +0.37 +/- 1.33 | +1.48e-02 +/- 5.36e-02 | 4.06e+00 +/- 4.2e-02 | 4.04e+00 +/- 3.3e-02 |
test_objective_compute_dshape_current | +1.53 +/- 5.03 | +8.17e-05 +/- 2.69e-04 | 5.42e-03 +/- 2.1e-04 | 5.34e-03 +/- 1.7e-04 |
test_objective_jac_dshape_current | +0.90 +/- 6.78 | +3.89e-04 +/- 2.93e-03 | 4.37e-02 +/- 2.3e-03 | 4.33e-02 +/- 1.8e-03 |
test_perturb_2 | +1.68 +/- 1.73 | +3.40e-01 +/- 3.50e-01 | 2.06e+01 +/- 2.4e-01 | 2.03e+01 +/- 2.5e-01 |
test_proximal_freeb_jac | +0.23 +/- 1.12 | +1.71e-02 +/- 8.30e-02 | 7.45e+00 +/- 4.8e-02 | 7.43e+00 +/- 6.8e-02 |
test_solve_fixed_iter | +1.14 +/- 1.96 | +3.72e-01 +/- 6.41e-01 | 3.30e+01 +/- 3.9e-01 | 3.27e+01 +/- 5.1e-01 |
test_LinearConstraintProjection_build | -0.01 +/- 2.51 | -8.17e-04 +/- 2.68e-01 | 1.07e+01 +/- 2.1e-01 | 1.07e+01 +/- 1.7e-01 |
test_build_transform_fft_midres | +3.96 +/- 5.72 | +2.47e-02 +/- 3.57e-02 | 6.49e-01 +/- 3.0e-02 | 6.24e-01 +/- 1.9e-02 |
test_build_transform_fft_highres | +0.76 +/- 3.29 | +7.60e-03 +/- 3.29e-02 | 1.01e+00 +/- 2.1e-02 | 1.00e+00 +/- 2.5e-02 |
test_equilibrium_init_lowres | +4.34 +/- 4.30 | +1.75e-01 +/- 1.74e-01 | 4.22e+00 +/- 1.3e-01 | 4.04e+00 +/- 1.2e-01 |
test_objective_compile_atf | -1.19 +/- 3.47 | -9.91e-02 +/- 2.90e-01 | 8.24e+00 +/- 2.3e-01 | 8.34e+00 +/- 1.8e-01 |
test_objective_compute_atf | -0.08 +/- 5.21 | -1.47e-05 +/- 9.08e-04 | 1.74e-02 +/- 8.5e-04 | 1.74e-02 +/- 3.3e-04 |
test_objective_jac_atf | -0.27 +/- 2.91 | -5.32e-03 +/- 5.79e-02 | 1.98e+00 +/- 4.1e-02 | 1.99e+00 +/- 4.1e-02 |
test_perturb_1 | -2.75 +/- 3.95 | -4.34e-01 +/- 6.22e-01 | 1.53e+01 +/- 5.1e-01 | 1.58e+01 +/- 3.5e-01 |
test_proximal_jac_atf | +0.19 +/- 1.45 | +1.59e-02 +/- 1.20e-01 | 8.31e+00 +/- 9.1e-02 | 8.29e+00 +/- 7.8e-02 |
test_proximal_freeb_compute | +1.81 +/- 1.44 | +3.61e-03 +/- 2.87e-03 | 2.04e-01 +/- 2.2e-03 | 2.00e-01 +/- 1.8e-03 |
test_solve_fixed_iter_compiled | -0.88 +/- 1.34 | -1.85e-01 +/- 2.82e-01 | 2.09e+01 +/- 1.9e-01 | 2.11e+01 +/- 2.1e-01 | |
desc/integrals/singularities.py
Outdated
@@ -672,7 +673,7 @@ def _kernel_biot_savart(eval_data, source_data, diag=False): | |||
r = r[:, None] | |||
else: | |||
r = r[:, :, None] | |||
return 1e-7 * safediv(num, r**3) | |||
return scipy.constants.mu_0 / 4 / jnp.pi * safediv(num, r**3) |
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.
Why not import once at the top and use the same mu_0?
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.
I meant to remove the scipy.constants import and just use the scipy module. I'll do that now
@@ -68,7 +68,7 @@ def body(i, B): | |||
B = B + jnp.where(den[:, None] == 0, 0, num / den[:, None]) | |||
return B | |||
|
|||
return 1e-7 * fori_loop(0, J.shape[0], body, B) | |||
return scipy.constants.mu_0 / 4 / jnp.pi * fori_loop(0, J.shape[0], body, B) |
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.
Does importing mu0 once affect jit?
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, I just didn't think to change the imports for this file.
No description provided.