-
Notifications
You must be signed in to change notification settings - Fork 26
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
Plotting Unit Tests have missed a regression #1280
Comments
I'll gladly provide a fix, but would like to confirm the expected behavior of |
Hi @missing-user! Thanks for pointing out this bug! Yes, the @dpanici I checked to see if the NFP change to the grid caused this, but it was behaving the same, so maybe something else caused it? |
Thanks for the quick response! Specifically line 520 in the unit test Since the unit test reflects the expected usage, I suggest changing the behavior in if isinstance(phi, numbers.Integral):
- phi = np.linspace(0, 2 * np.pi / eqs[-1].NFP, phi+1) # +1 to include pi and 2pi
+ phi = np.linspace(0, 2 * np.pi / eqs[-1].NFP, phi, endpoint=False) So we don't have to skip the last point when plotting -for j in range(nz - 1):
+for j in range(nz):
(line,) = ax.plot(
R[:, -1, j], Z[:, -1, j], color=colors[i], linestyle=ls[i], lw=lw[i]
) This doesn't change the default plotting behavior (when passing an integer), and causes the expected behavior of plotting N slices when passing N phi values. It is also more consistent with the other plotting functions. |
I think part of the reason this wasn't caught is that test should really be using |
Yeah, I agree. #1272 (comment)
as implemented in PR #1272 |
There's been a regression in the plotting functionality which wasn't detected by the unit tests.
I would strongly suggest tightening the RMS tolerances in the unit test to avoid further cases in the future.
7b6b5a3 changed the result of plot_boundaries from the baseline that is checked in
to
Since the difference is only
RMS=7.5607620133305495 < tol_2d
the unit tests passedhttps://github.com/PlasmaControl/DESC/actions/runs/10511648755/job/29123115558
and allowed the change to merge.
Steps to reproduce
Checkout any DESC version after and run the unit tests for plotting
pytest --mpl tests/test_plotting.py::TestPlotBoundary::test_plot_boundaries
This will complete successfully although it shouldn't. In
tests/test_plotting.py
lowertol_2d=5
and investigate the resulting images, the red boundary only shows 3 cross sections.Expected behavior
From the function signature and description it sounds like passing an array with 4 phi values would also plot 4 cross sections (baseline image that is checked in), but it skips the last one (second image, current behavior since 7b6b5a3). @dpanici was that the intention when creating #1204 ?
The text was updated successfully, but these errors were encountered: