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

py_spec minor bugfix #218

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions Utilities/pythontools/py_spec/output/_plot_iota.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ def plot_iota(self, xaxis="R", yaxis="i", ax=None, **kwargs):
plt.sca(ax)
# set default plotting parameters
# use dots
if kwargs.get("marker") == None:
if "marker" not in kwargs:
kwargs.update({"marker": "*"})
# use gray color
if kwargs.get("c") == None:
if "c" not in kwargs:
pass
# kwargs.update({"c": "gray"})

Expand Down
4 changes: 2 additions & 2 deletions Utilities/pythontools/py_spec/output/_plot_kam_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def plot_kam_surface(self, ns=[], ntheta=1000, zeta=0.0, ax=None, **kwargs):
fig, ax = plt.subplots()
plt.sca(ax)
# set default plotting parameters
if kwargs.get("label") == None:
if "label" not in kwargs:
kwargs.update({"label": "SPEC_KAM"}) # default label
if kwargs.get("c") == None:
if "c" not in kwargs:
kwargs.update({"c": "red"})
# plot all the surfaces
if Igeometry == 3:
Expand Down
2 changes: 1 addition & 1 deletion Utilities/pythontools/py_spec/output/_plot_modB.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def plot_modB(
import matplotlib.pyplot as plt

Nvol = self.input.physics.Nvol
if lvol == None:
if lvol is None:
lvollist = np.arange(0, Nvol, dtype=int).tolist()
elif np.isscalar(lvol):
lvollist = [lvol]
Expand Down
11 changes: 8 additions & 3 deletions Utilities/pythontools/py_spec/output/_plot_poincare.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,24 @@ def plot_poincare(self, toroidalIdx=0, prange="full", ax=None, **kwargs):
zz = self.poincare.R[:, :, toroidalIdx] * np.sin(
self.poincare.t[:, :, toroidalIdx]
)

# Replace invalid values (unsuccessful tracing) with nan for plotting
zz[(self.poincare.success[:,np.newaxis]!=1) | ((rr==0) & (zz==0))] = np.nan
rr[(self.poincare.success[:,np.newaxis]!=1) | ((rr==0) & (zz==0))] = np.nan

# get axix data
if ax is None:
fig, ax = plt.subplots()
plt.sca(ax)
# set default plotting parameters
# use dots
if kwargs.get("marker") == None:
if "marker" not in kwargs:
kwargs.update({"marker": "."})
# use gray color
if kwargs.get("c") == None:
if "c" not in kwargs:
pass
# size of marker
if kwargs.get("s") == None:
if "s" not in kwargs:
kwargs.update({"s": 0.3})
# kwargs.update({"c": "gray"})
# make plot depending on the 'range'
Expand Down
4 changes: 2 additions & 2 deletions Utilities/pythontools/py_spec/output/_plot_pressure.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def plot_pressure(self, normalize=True, ax=None, **kwargs):
fig, ax = plt.subplots()
plt.sca(ax)
# set default plotting parameters
if kwargs.get("linewidth") == None:
if "linewidth" not in kwargs:
kwargs.update({"linewidth": 2.0}) # prefer thicker lines
if kwargs.get("label") == None:
if "label" not in kwargs:
kwargs.update({"label": "self_pressure"}) # default label
# process data
_tflux = np.insert(tflux, 0, 0)
Expand Down
2 changes: 1 addition & 1 deletion Utilities/pythontools/py_spec/output/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self, *args, **kwargs):
# as self.`args[0]`

_content = None
if kwargs.get("content") == None:
if "content" not in kwargs:
# assume arg[0] is a filename
_content = h5py.File(args[0], "r")

Expand Down
Loading