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

Treating E and H as complex while plotting abs(E) #248

Merged
merged 1 commit into from
Nov 24, 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
12 changes: 6 additions & 6 deletions gplugins/modes/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ def plot_e(
"""Plot Electric field module."""
E = self.E / abs(max(self.E.min(), self.E.max(), key=abs)) if scale else self.E
Eabs = np.sqrt(
np.multiply(E[:, :, 0, 2], E[:, :, 0, 2])
+ np.multiply(E[:, :, 0, 1], E[:, :, 0, 1])
+ np.multiply(E[:, :, 0, 0], E[:, :, 0, 0])
np.multiply(E[:, :, 0, 2].conjugate(), E[:, :, 0, 2])
+ np.multiply(E[:, :, 0, 1].conjugate(), E[:, :, 0, 1])
+ np.multiply(E[:, :, 0, 0].conjugate(), E[:, :, 0, 0])
)
ep = abs(Eabs)
ep = 10 * np.log10(ep) if logscale else ep
Expand Down Expand Up @@ -304,9 +304,9 @@ def plot_h(
) -> None:
H = self.H / abs(max(self.H.min(), self.H.max(), key=abs)) if scale else self.H
Habs = np.sqrt(
np.multiply(H[:, :, 0, 2], H[:, :, 0, 2])
+ np.multiply(H[:, :, 0, 1], H[:, :, 0, 1])
+ np.multiply(H[:, :, 0, 0], H[:, :, 0, 0])
np.multiply(H[:, :, 0, 2].conjugate(), H[:, :, 0, 2])
+ np.multiply(H[:, :, 0, 1].conjugate(), H[:, :, 0, 1])
+ np.multiply(H[:, :, 0, 0].conjugate(), H[:, :, 0, 0])
)
hp = abs(Habs)
hp = 10 * np.log10(hp) if logscale else hp
Expand Down