plot_template_over_pattern#
- pyxem.utils.plot_template_over_pattern(pattern, simulation, ax=None, in_plane_angle=0.0, max_r=None, find_direct_beam=True, direct_beam_position=None, mirrored_template=False, coordinate_system='cartesian', marker_color='red', marker_type='x', size_factor=1.0, **kwargs)[source]#
A quick utility function to plot a simulated pattern over an experimental image
- Parameters:
pattern (2D np.ndarray) – The diffraction pattern
simulation (
diffsims.sims.diffraction_simulation.DiffractionSimulation
) – The simulated diffraction pattern. It must be calibrated.axis (matplotlib.AxesSubplot, optional) – An axis object on which to plot. If None is provided, one will be created.
in_plane_angle (float, optional) – An in-plane rotation angle to apply to the template in degrees
max_r (float, optional) – Maximum radius to consider in the polar transform in pixel coordinates. Will only influence the result if
coordinate_system="polar"
.find_direct_beam (bool, optional) – Roughly find the optimal direct beam position if it is not centered.
direct_beam_position (2-tuple) – The (x, y) position of the direct beam in pixel coordinates. Takes precedence over find_direct_beam
mirrored_template (bool, optional) – Whether to mirror the given template
coordinate_system (str, optional) – Type of coordinate system to plot the image and template in. Either
cartesian
orpolar
marker_color (str, optional) – Color of the spot markers
marker_type (str, optional) – Type of marker used for the spots
size_factor (float, optional) – Scaling factor for the spots. See notes on size.
**kwargs – See
matplotlib.pyplot.imshow()
- Returns:
ax (matplotlib.AxesSubplot) – The axes object
im (matplotlib.image.AxesImage) – The representation of the image on the axes
sp (matplotlib.collections.PathCollection) – The scatter plot representing the diffraction pattern
Notes
The spot marker sizes are scaled by the square root of their intensity