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

Example AxesInDifferentUnits: prepare for transform at result level

parent f6bd8bdd
No related branches found
No related tags found
1 merge request!1842handle coordinate name and unit in new class Coordinate
......@@ -27,52 +27,34 @@ def get_simulation(sample):
return simulation
def plot(result):
def transformed_plot(i, result, title):
"""
Plots simulation results for different detectors.
"""
# set plotting parameters
rcParams['image.aspect'] = 'auto'
plt.figure(figsize=(10, 10))
plt.subplot(2, 2, 1)
# default units for rectangular detector are millimeters
plt.subplot(2, 2, i)
bp.plot_simres(result,
xlabel=r'$x \;({\rm mm})$',
ylabel=r'$y \;({\rm mm})$',
# xlabel=r'$x \;({\rm mm})$',
# ylabel=r'$y \;({\rm mm})$',
zlabel=None,
with_cb=False)
plt.title("Default: real-space detector coordinates", loc='left')
plt.title(title, loc='left')
plt.subplot(2, 2, 2)
bp.plot_simres(result,
# units=ba.Coords_NBINS,
xlabel=r'$X_{\rm bin}$',
ylabel=r'$Y_{\rm bin}$',
zlabel=None,
with_cb=False)
plt.title("Bin indices", loc='left')
plt.subplot(2, 2, 3)
bp.plot_simres(result,
# units=ba.Coords_DEGREES,
xlabel=r'$\varphi_{\rm f} \;(^{\circ})$',
ylabel=r'$\alpha_{\rm f} \;(^{\circ})$',
zlabel=None,
with_cb=False)
plt.title("Deflection angles", loc='left')
if __name__ == '__main__':
simulation = get_simulation(get_sample())
result = simulation.simulate()
plt.subplot(2, 2, 4)
bp.plot_simres(result,
# units=ba.Coords_QSPACE,
xlabel=r'$Q_{y} \;(1/{\rm nm})$',
ylabel=r'$Q_{z} \;(1/{\rm nm})$',
zlabel=None,
with_cb=False)
plt.title("Q space", loc='left')
# setup plot
rcParams['image.aspect'] = 'auto'
plt.figure(figsize=(10, 10))
transformed_plot(1, result, "Default: real-space detector coordinates")
transformed_plot(2, result, "Bin indices")
transformed_plot(3, result, "Deflection angles")
transformed_plot(4, result, "Q space")
# finish plot
plt.subplots_adjust(
left=0.07,
right=0.97,
......@@ -81,11 +63,4 @@ def plot(result):
hspace=0.35,
wspace=0.,
)
if __name__ == '__main__':
simulation = get_simulation(get_sample())
result = simulation.simulate()
plot(result)
bp.show_or_export()
......@@ -27,52 +27,34 @@ def get_simulation(sample):
return simulation
def plot(result):
def transformed_plot(i, result, title):
"""
Plots simulation results for different detectors.
"""
# set plotting parameters
rcParams['image.aspect'] = 'auto'
plt.figure(figsize=(10, 10))
plt.subplot(2, 2, 1)
# default units for rectangular detector are millimeters
plt.subplot(2, 2, i)
bp.plot_simres(result,
xlabel=r'$x \;({\rm mm})$',
ylabel=r'$y \;({\rm mm})$',
# xlabel=r'$x \;({\rm mm})$',
# ylabel=r'$y \;({\rm mm})$',
zlabel=None,
with_cb=False)
plt.title("Default: real-space detector coordinates", loc='left')
plt.title(title, loc='left')
plt.subplot(2, 2, 2)
bp.plot_simres(result,
# units=ba.Coords_NBINS,
xlabel=r'$X_{\rm bin}$',
ylabel=r'$Y_{\rm bin}$',
zlabel=None,
with_cb=False)
plt.title("Bin indices", loc='left')
plt.subplot(2, 2, 3)
bp.plot_simres(result,
# units=ba.Coords_DEGREES,
xlabel=r'$\varphi_{\rm f} \;(^{\circ})$',
ylabel=r'$\alpha_{\rm f} \;(^{\circ})$',
zlabel=None,
with_cb=False)
plt.title("Deflection angles", loc='left')
if __name__ == '__main__':
simulation = get_simulation(get_sample())
result = simulation.simulate()
plt.subplot(2, 2, 4)
bp.plot_simres(result,
# units=ba.Coords_QSPACE,
xlabel=r'$Q_{y} \;(1/{\rm nm})$',
ylabel=r'$Q_{z} \;(1/{\rm nm})$',
zlabel=None,
with_cb=False)
plt.title("Q space", loc='left')
# setup plot
rcParams['image.aspect'] = 'auto'
plt.figure(figsize=(10, 10))
transformed_plot(1, result, "Default: real-space detector coordinates")
transformed_plot(2, result, "Bin indices")
transformed_plot(3, result, "Deflection angles")
transformed_plot(4, result, "Q space")
# finish plot
plt.subplots_adjust(
left=0.07,
right=0.97,
......@@ -81,11 +63,4 @@ def plot(result):
hspace=0.35,
wspace=0.,
)
if __name__ == '__main__':
simulation = get_simulation(get_sample())
result = simulation.simulate()
plot(result)
bp.show_or_export()
......@@ -27,52 +27,34 @@ def get_simulation(sample):
return simulation
def plot(result):
def transformed_plot(i, result, title):
"""
Plots simulation results for different detectors.
"""
# set plotting parameters
rcParams['image.aspect'] = 'auto'
plt.figure(figsize=(10, 10))
plt.subplot(2, 2, 1)
# default units for rectangular detector are millimeters
plt.subplot(2, 2, i)
bp.plot_simres(result,
xlabel=r'$x \;({\rm mm})$',
ylabel=r'$y \;({\rm mm})$',
# xlabel=r'$x \;({\rm mm})$',
# ylabel=r'$y \;({\rm mm})$',
zlabel=None,
with_cb=False)
plt.title("Default: real-space detector coordinates", loc='left')
plt.title(title, loc='left')
plt.subplot(2, 2, 2)
bp.plot_simres(result,
# units=ba.Coords_NBINS,
xlabel=r'$X_{\rm bin}$',
ylabel=r'$Y_{\rm bin}$',
zlabel=None,
with_cb=False)
plt.title("Bin indices", loc='left')
plt.subplot(2, 2, 3)
bp.plot_simres(result,
# units=ba.Coords_DEGREES,
xlabel=r'$\varphi_{\rm f} \;(^{\circ})$',
ylabel=r'$\alpha_{\rm f} \;(^{\circ})$',
zlabel=None,
with_cb=False)
plt.title("Deflection angles", loc='left')
if __name__ == '__main__':
simulation = get_simulation(get_sample())
result = simulation.simulate()
plt.subplot(2, 2, 4)
bp.plot_simres(result,
# units=ba.Coords_QSPACE,
xlabel=r'$Q_{y} \;(1/{\rm nm})$',
ylabel=r'$Q_{z} \;(1/{\rm nm})$',
zlabel=None,
with_cb=False)
plt.title("Q space", loc='left')
# setup plot
rcParams['image.aspect'] = 'auto'
plt.figure(figsize=(10, 10))
transformed_plot(1, result, "Default: real-space detector coordinates")
transformed_plot(2, result, "Bin indices")
transformed_plot(3, result, "Deflection angles")
transformed_plot(4, result, "Q space")
# finish plot
plt.subplots_adjust(
left=0.07,
right=0.97,
......@@ -81,11 +63,4 @@ def plot(result):
hspace=0.35,
wspace=0.,
)
if __name__ == '__main__':
simulation = get_simulation(get_sample())
result = simulation.simulate()
plot(result)
bp.show_or_export()
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