Skip to content
Snippets Groups Projects
Commit 2b70cb30 authored by Yurov, Dmitry's avatar Yurov, Dmitry
Browse files

Deploy SimulationResult::axis in examples and plot utils.

Redmine: #2305
parent e566365f
No related branches found
No related tags found
No related merge requests found
......@@ -87,9 +87,7 @@ def plot(result_wl, result_qz):
ba.plot_simulation_result(result_qz, postpone_show=True)
wl_sim_data = result_wl.data()
wl_axis = wl_sim_data.getAxis(0).getBinCenters()
plt.semilogy(wl_axis, result_wl.array(), 'ko', markevery=10)
plt.semilogy(result_wl.axis(), result_wl.array(), 'ko', markevery=10)
plt.legend([r'$q_z$-defined beam',
r'$\lambda$-defined beam'],
loc='upper right')
......
......@@ -167,9 +167,8 @@ def plot_specular_simulation_result(result, ymin=None, ymax=None, units=ba.AxesU
:param units: units on the x-axis
"""
data = result.data(units)
intensity = data.getArray()
x_axis = data.getAxis(0).getBinCenters()
intensity = result.array()
x_axis = result.axis(units)
ymax = np.amax(intensity) * 2.0 if ymax is None else ymax
ymin = max(np.amin(intensity) * 0.5, 1e-18 * ymax) if ymin is None else ymin
......@@ -456,12 +455,12 @@ class PlotterSpecular(Plotter):
def plot_graph(self, fit_objective):
# retrieving data from fit suite
real_data = fit_objective.experimentalData().data()
sim_data = fit_objective.simulationResult().data()
real_data = fit_objective.experimentalData()
sim_data = fit_objective.simulationResult()
# data values
sim_values = sim_data.getArray()
real_values = real_data.getArray()
sim_values = sim_data.array()
real_values = real_data.array()
# default font properties dictionary to use
font = {'family': 'serif',
......@@ -469,11 +468,11 @@ class PlotterSpecular(Plotter):
'size': label_fontsize}
plt.subplot(self.gs[0])
plt.semilogy(sim_data.getAxis(0).getBinCenters(), sim_values, 'b',
real_data.getAxis(0).getBinCenters(), real_values, 'k--')
plt.semilogy(sim_data.axis(), sim_values, 'b',
real_data.axis(), real_values, 'k--')
plt.ylim((0.5 * np.min(real_values), 5 * np.max(real_values)))
xlabel = get_axes_labels(fit_objective.experimentalData(), ba.AxesUnits.DEFAULT)[0]
xlabel = get_axes_labels(real_data, ba.AxesUnits.DEFAULT)[0]
plt.legend(['BornAgain', 'Reference'], loc='upper right', prop=font)
plt.xlabel(xlabel, fontdict=font)
plt.ylabel("Intensity", fontdict=font)
......
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