Skip to content
Snippets Groups Projects
Commit f1af4735 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

ba_plot: follow pylint style advice

parent f10883cf
No related branches found
No related tags found
1 merge request!363Further improvements to Python code as suggested by Pylint
......@@ -24,7 +24,7 @@ except Exception as e:
label_fontsize = 16
# default values from environment variables
CMAP = "CMAP" in os.environ and os.environ["CMAP"] or 'inferno'
CMAP = os.environ['CMAP'] if 'CMAP' in os.environ else 'inferno'
NOSHOW = "NOSHOW" in os.environ
......@@ -68,8 +68,7 @@ def translate_axis_label(label):
}
if label in label_dict.keys():
return label_dict[label]
else:
return label
return label
def get_axes_labels(result, units):
......@@ -139,9 +138,9 @@ def plot_histogram(hist, **kwargs):
:param zmax: Max value on amplitude's color bar
"""
if not 'xlabel' in kwargs:
if 'xlabel' not in kwargs:
kwargs['xlabel'] = translate_axis_label(hist.xAxis().axisName())
if not 'ylabel' in kwargs:
if 'ylabel' not in kwargs:
kwargs['ylabel'] = translate_axis_label(hist.yAxis().axisName())
axes_limits = [
......@@ -171,9 +170,9 @@ def plot_colormap(result, **kwargs):
axes_limits = get_axes_limits(result, units)
axes_labels = get_axes_labels(result, units)
if not 'xlabel' in kwargs:
if 'xlabel' not in kwargs:
kwargs['xlabel'] = axes_labels[0]
if not 'ylabel' in kwargs:
if 'ylabel' not in kwargs:
kwargs['ylabel'] = axes_labels[1]
return plot_array(result.array(), axes_limits=axes_limits, **kwargs)
......@@ -230,7 +229,7 @@ def plot_simulation_result(result, **kwargs):
else:
plot_colormap(result, **kwargs)
plt.tight_layout()
if not (noshow):
if not noshow:
plt.show()
else:
print("plot_simulation_result: noshow")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment