Skip to content

Commit

Permalink
Increase tolerance for plotting test
Browse files Browse the repository at this point in the history
  • Loading branch information
unalmis committed Aug 29, 2024
1 parent 6896586 commit deff086
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion desc/integrals/bounce_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,7 @@ def plot_ppoly(
stop=None,
include_knots=False,
knot_transparency=0.1,
include_legend=True,
):
"""Plot the piecewise polynomial ``ppoly``.
Expand Down Expand Up @@ -836,7 +837,8 @@ def plot_ppoly(
)
ax.set_xlabel(hlabel)
ax.set_ylabel(vlabel)
ax.legend(legend.values(), legend.keys(), loc="lower right")
if include_legend:
ax.legend(legend.values(), legend.keys(), loc="lower right")
ax.set_title(title)
plt.tight_layout()
if show:
Expand Down
Binary file modified tests/baseline/test_bounce1d_checks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 8 additions & 3 deletions tests/test_integrals.py
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ def _example_denominator(B, pitch):
return safediv(1, jnp.sqrt(jnp.abs(1 - pitch * B)))

@pytest.mark.unit
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=tol_1d)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=tol_1d * 4)
def test_bounce1d_checks(self):
"""Test that all the internal correctness checks pass for real example."""
# noqa: D202
Expand All @@ -1078,7 +1078,12 @@ def test_bounce1d_checks(self):
Bounce1D.required_names + ["min_tz |B|", "max_tz |B|", "g_zz"], grid=grid
)
# 5. Make the bounce integration operator.
bounce = Bounce1D(grid.source_grid, data, check=True)
bounce = Bounce1D(
grid.source_grid,
data,
quad=leggauss(3), # not checking quadrature accuracy in this test
check=True,
)
pitch_inv = bounce.get_pitch_inv(
grid.compress(data["min_tz |B|"]), grid.compress(data["max_tz |B|"]), 10
)
Expand Down Expand Up @@ -1113,7 +1118,7 @@ def test_bounce1d_checks(self):
print("(α, ρ):", nodes[m, l, 0])

# 7. Plotting
fig, ax = bounce.plot(pitch_inv[..., l], m, l, show=False)
fig, ax = bounce.plot(pitch_inv[..., l], m, l, include_legend=False, show=False)
return fig

@pytest.mark.unit
Expand Down

0 comments on commit deff086

Please sign in to comment.