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

Poincare options #362

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/simsopt/field/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,8 @@
pass


def plot_poincare_data(fieldlines_phi_hits, phis, filename, mark_lost=False, aspect='equal', dpi=300, xlims=None, ylims=None, surf=None):
def plot_poincare_data(fieldlines_phi_hits, phis, filename, mark_lost=False, aspect='equal', dpi=300, xlims=None,
ylims=None, surf=None, s=2, marker='o'):
"""
Create a poincare plot. Usage:

Expand Down Expand Up @@ -835,9 +836,9 @@
if col == 1:
axs[row, col].set_yticklabels([])
if xlims is not None:
axs[row, col].set_xlim(xlims)

Check warning on line 839 in src/simsopt/field/tracing.py

View check run for this annotation

Codecov / codecov/patch

src/simsopt/field/tracing.py#L839

Added line #L839 was not covered by tests
if ylims is not None:
axs[row, col].set_ylim(ylims)

Check warning on line 841 in src/simsopt/field/tracing.py

View check run for this annotation

Codecov / codecov/patch

src/simsopt/field/tracing.py#L841

Added line #L841 was not covered by tests
for j in range(len(fieldlines_phi_hits)):
lost = fieldlines_phi_hits[j][-1, 1] < 0
if mark_lost:
Expand All @@ -846,17 +847,17 @@
if data_this_phi.size == 0:
continue
r = np.sqrt(data_this_phi[:, 2]**2+data_this_phi[:, 3]**2)
axs[row, col].scatter(r, data_this_phi[:, 4], marker='o', s=2, linewidths=0, c=color)
axs[row, col].scatter(r, data_this_phi[:, 4], marker=marker, s=s, linewidths=0, c=color)

plt.rc('axes', axisbelow=True)
axs[row, col].grid(True, linewidth=0.5)

# if passed a surface, plot the plasma surface outline
if surf is not None:
cross_section = surf.cross_section(phi=phis[i])
r_interp = np.sqrt(cross_section[:, 0] ** 2 + cross_section[:, 1] ** 2)
z_interp = cross_section[:, 2]
axs[row, col].plot(r_interp, z_interp, linewidth=1, c='k')

Check warning on line 860 in src/simsopt/field/tracing.py

View check run for this annotation

Codecov / codecov/patch

src/simsopt/field/tracing.py#L857-L860

Added lines #L857 - L860 were not covered by tests

plt.tight_layout()
plt.savefig(filename, dpi=dpi)
Expand Down
Loading