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

[bpplot1] minor improvements for ba_plot ()

Merging branch 'bpplot1'  into 'main'.

See merge request !1700
parents 3376341e c6499d34
No related branches found
No related tags found
1 merge request!1700minor improvements for ba_plot
Pipeline #102824 passed
...@@ -110,6 +110,7 @@ def get_axes_labels(result, units): ...@@ -110,6 +110,7 @@ def get_axes_labels(result, units):
:param result: SimulationResult object from a Simulation :param result: SimulationResult object from a Simulation
:param units: units to use :param units: units to use
:return: axes ranges as a flat list :return: axes ranges as a flat list
Used internally and in Examples/fit/specular/RealLifeReflectometryFitting.py.
""" """
labels = [] labels = []
for i in range(result.rank()): for i in range(result.rank()):
...@@ -126,6 +127,7 @@ def get_axes_labels(result, units): ...@@ -126,6 +127,7 @@ def get_axes_labels(result, units):
def inside_ticks(): def inside_ticks():
""" """
Ticks settings for xy plots: on all axes and pointing inside. Ticks settings for xy plots: on all axes and pointing inside.
Used internally and in a few examples.
""" """
plt.gca().yaxis.set_ticks_position('both') plt.gca().yaxis.set_ticks_position('both')
plt.gca().xaxis.set_ticks_position('both') plt.gca().xaxis.set_ticks_position('both')
...@@ -135,6 +137,7 @@ def inside_ticks(): ...@@ -135,6 +137,7 @@ def inside_ticks():
def plot_array(array, axes_limits=None, **kwargs): def plot_array(array, axes_limits=None, **kwargs):
""" """
Plots numpy array as a heatmap in log scale. Plots numpy array as a heatmap in log scale.
Used internally and in Examples/varia/AccessingSimulationResults.py.
""" """
assert len(array.shape) == 2 assert len(array.shape) == 2
...@@ -195,6 +198,7 @@ def plot_histogram(field, **kwargs): ...@@ -195,6 +198,7 @@ def plot_histogram(field, **kwargs):
""" """
Plots intensity data as heat map Plots intensity data as heat map
:param field: two-dimensional Datafield :param field: two-dimensional Datafield
Used internally and in a few examples.
""" """
if 'xlabel' not in kwargs: if 'xlabel' not in kwargs:
...@@ -216,6 +220,7 @@ def plot_simres(result, **kwargs): ...@@ -216,6 +220,7 @@ def plot_simres(result, **kwargs):
""" """
Plots intensity data as heat map Plots intensity data as heat map
:param result: SimulationResult from GISAS/OffspecSimulation :param result: SimulationResult from GISAS/OffspecSimulation
Used internally and in a few examples.
""" """
units = kwargs.pop('units', ba.Coords_UNDEFINED) units = kwargs.pop('units', ba.Coords_UNDEFINED)
...@@ -231,7 +236,9 @@ def plot_simres(result, **kwargs): ...@@ -231,7 +236,9 @@ def plot_simres(result, **kwargs):
def plot_curve(xarray, yarray, **kwargs): def plot_curve(xarray, yarray, **kwargs):
"""
Used internally.
"""
title = kwargs.pop('title', None) title = kwargs.pop('title', None)
xlabel = kwargs.pop('xlabel', None) xlabel = kwargs.pop('xlabel', None)
ylabel = kwargs.pop('ylabel', None) ylabel = kwargs.pop('ylabel', None)
...@@ -252,6 +259,7 @@ def plot_specular_curve(result): ...@@ -252,6 +259,7 @@ def plot_specular_curve(result):
""" """
Plots intensity data for specular simulation result Plots intensity data for specular simulation result
:param result: SimulationResult from SpecularSimulation :param result: SimulationResult from SpecularSimulation
Used internally.
""" """
units = plotargs.pop('units', ba.Coords_UNDEFINED) units = plotargs.pop('units', ba.Coords_UNDEFINED)
...@@ -277,7 +285,10 @@ def plot_specular_curve(result): ...@@ -277,7 +285,10 @@ def plot_specular_curve(result):
def save_results(results, name): def save_results(results, name):
# Output to data file, image file, and display. """
Output to data file, image file, and display.
Used internally.
"""
nDigits = int(math.log10(len(results))) + 1 nDigits = int(math.log10(len(results))) + 1
formatN = "%" + str(nDigits) + "i" formatN = "%" + str(nDigits) + "i"
for i, result in enumerate(results): for i, result in enumerate(results):
...@@ -286,6 +297,9 @@ def save_results(results, name): ...@@ -286,6 +297,9 @@ def save_results(results, name):
class MultiPlot: class MultiPlot:
"""
Used internally.
"""
def __init__(self, n, ncol, fontsize=None): def __init__(self, n, ncol, fontsize=None):
self.n = n self.n = n
...@@ -365,8 +379,6 @@ def parse_args(**kwargs): ...@@ -365,8 +379,6 @@ def parse_args(**kwargs):
:param ymax: maximum y-axis value to show :param ymax: maximum y-axis value to show
:param zmin: Min value on amplitude's color legend :param zmin: Min value on amplitude's color legend
:param zmax: Max value on amplitude's color legend :param zmax: Max value on amplitude's color legend
:param det: Detector (??)
:param ncol: Number of columns in multiplot
""" """
tmp = {} tmp = {}
for key, val in kwargs.items(): for key, val in kwargs.items():
...@@ -440,8 +452,6 @@ def plot_simulation_result(result): ...@@ -440,8 +452,6 @@ def plot_simulation_result(result):
show_or_export() show_or_export()
return 0
def make_plot_row(results): def make_plot_row(results):
make_plot(results, len(results)) make_plot(results, len(results))
......
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