-
Notifications
You must be signed in to change notification settings - Fork 27
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 connected theta edges for plot3d #1237
Conversation
Here is the code to generate this plot, import plotly.graph_objects as go
from desc.grid import LinearGrid
from desc.plotting import plot_3d
import numpy as np
fig = go.Figure()
for r in [0.3, 0.6, 1]:
grid = LinearGrid(
rho=r,
theta=np.linspace(0, 2 * np.pi, 200),
zeta=np.linspace(0, 2 * np.pi/eq.NFP, 200),
sym=True,
)
plot_3d(eq, "|B|", grid=grid, fig=fig)
fig.show() |
| benchmark_name | dt(%) | dt(s) | t_new(s) | t_old(s) |
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
test_build_transform_fft_lowres | +0.46 +/- 6.48 | +2.40e-03 +/- 3.38e-02 | 5.24e-01 +/- 2.3e-02 | 5.22e-01 +/- 2.5e-02 |
test_equilibrium_init_medres | -0.37 +/- 1.06 | -1.55e-02 +/- 4.41e-02 | 4.14e+00 +/- 2.9e-02 | 4.15e+00 +/- 3.3e-02 |
test_equilibrium_init_highres | -0.05 +/- 2.09 | -2.90e-03 +/- 1.15e-01 | 5.49e+00 +/- 6.0e-02 | 5.49e+00 +/- 9.8e-02 |
test_objective_compile_dshape_current | -0.17 +/- 0.79 | -6.41e-03 +/- 3.02e-02 | 3.83e+00 +/- 1.5e-02 | 3.83e+00 +/- 2.6e-02 |
test_objective_compute_dshape_current | +0.13 +/- 2.24 | +4.29e-06 +/- 7.69e-05 | 3.43e-03 +/- 6.4e-05 | 3.43e-03 +/- 4.3e-05 |
test_objective_jac_dshape_current | -1.05 +/- 7.03 | -4.26e-04 +/- 2.85e-03 | 4.01e-02 +/- 1.6e-03 | 4.06e-02 +/- 2.4e-03 |
test_perturb_2 | -0.30 +/- 2.18 | -5.28e-02 +/- 3.79e-01 | 1.74e+01 +/- 1.2e-01 | 1.74e+01 +/- 3.6e-01 |
test_proximal_freeb_jac | +0.49 +/- 1.35 | +3.67e-02 +/- 1.01e-01 | 7.52e+00 +/- 9.7e-02 | 7.48e+00 +/- 2.5e-02 |
test_solve_fixed_iter | -0.13 +/- 60.08 | -6.64e-03 +/- 2.96e+00 | 4.93e+00 +/- 2.1e+00 | 4.93e+00 +/- 2.1e+00 |
test_build_transform_fft_midres | -0.02 +/- 3.25 | -9.48e-05 +/- 1.96e-02 | 6.02e-01 +/- 1.8e-02 | 6.02e-01 +/- 7.5e-03 |
test_build_transform_fft_highres | -0.35 +/- 1.69 | -3.48e-03 +/- 1.68e-02 | 9.93e-01 +/- 8.9e-03 | 9.97e-01 +/- 1.4e-02 |
test_equilibrium_init_lowres | -1.76 +/- 3.62 | -6.79e-02 +/- 1.40e-01 | 3.79e+00 +/- 1.8e-02 | 3.86e+00 +/- 1.4e-01 |
test_objective_compile_atf | -0.04 +/- 4.81 | -3.23e-03 +/- 3.78e-01 | 7.86e+00 +/- 2.4e-01 | 7.87e+00 +/- 2.9e-01 |
test_objective_compute_atf | +1.17 +/- 3.95 | +1.21e-04 +/- 4.06e-04 | 1.04e-02 +/- 2.6e-04 | 1.03e-02 +/- 3.2e-04 |
test_objective_jac_atf | -0.93 +/- 4.99 | -1.81e-02 +/- 9.66e-02 | 1.92e+00 +/- 8.9e-02 | 1.94e+00 +/- 3.7e-02 |
test_perturb_1 | +0.64 +/- 4.86 | +8.16e-02 +/- 6.16e-01 | 1.27e+01 +/- 4.2e-01 | 1.27e+01 +/- 4.5e-01 |
test_proximal_jac_atf | -0.64 +/- 1.41 | -5.24e-02 +/- 1.16e-01 | 8.19e+00 +/- 7.4e-02 | 8.24e+00 +/- 8.9e-02 |
test_proximal_freeb_compute | -0.80 +/- 0.96 | -1.48e-03 +/- 1.76e-03 | 1.82e-01 +/- 1.3e-03 | 1.84e-01 +/- 1.2e-03 | |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1237 +/- ##
==========================================
- Coverage 95.32% 95.31% -0.02%
==========================================
Files 90 90
Lines 22713 22713
==========================================
- Hits 21651 21648 -3
- Misses 1062 1065 +3
|
Does this still work correctly if the surface is closed? |
Those were also behaving well with this change. I can test again, it was really late when I tested it yesterday. |
Yes, it works, unless you specifically give a grid like this, eq = get("ATF")
grid = LinearGrid(
rho=1.,
theta=np.linspace(0, 2 * np.pi, 200, endpoint=False),
zeta=np.linspace(0, 2 * np.pi/eq.NFP, 200),
)
plot_3d(eq, '|B|', grid=grid) Because if you don't give a grid, the default grid created by |
Currently, if you don't give a full theta grid to
plot_3d
, it will connect the theta edges and end up this kind of plots,I don't know about you, but I want it to behave like this,