MicromagneticAnalysisTools.Plot

Tools for plotting simulation data and associated quantities.

class MicromagneticAnalysisTools.Plot.MagnetizationPlotter(plot_type, directory, plot_file, ax=None, z_index=0, component=None, plot_quiver=False, plot_impurity=False, plot_pinning=False, show_component=False, interpolation=None, limits=None, length_units=None, max_skyrmion_density=None, step=1, quiver_colour=[0, 0, 0], quiver_scale=3.0, quiver_headwidth=10, quiver_headlength=20, quiver_headaxislength=20, quiver_linewidth=5)

Class for dealing with plotting magnetization texture.

plot_type

The style of the plot, which can be “magnetization” which plots a HSL colour plot, “magnetization_single_component” which plots a single component specified by the component attribute, “skyrmion_density”, which plots skyrmion density, or “quiveronly”, which shows arrows.

Type:

str

directory

The directory in which the simulation data is stored.

Type:

str

plot_file

The file to be plotted (e.g. “m000231.ovf”).

Type:

str

ax

The Matplotlib axis on which to plot.

Type:

matplotlib.axis.Axis

z_index

The index along the z-axis for which the skyrmion centre should be calculated (for a 3D sample).

Type:

int, optional

component

For the case that plot_type is magnetization_single_component, this speficied the component.

Type:

str, optional

plot_quiver

Whether to plot arrows. Will also be set to True if plot_type is quiveronly but this argument is not given.

Type:

bool, optional

plot_impurity

Whether or not to plot an impurity (e.g. region of modified uniaxial anisotropy).

Type:

bool, optional

plot_pinning

Whether or not to plot a region in which the spins are frozen (shown in semi-transparent grey).

Type:

bool, optional

interpolation

Interpolation method used for the colour plots (passed to matplotlib.pyplot.imshow).

Type:

str, optional

limits

Limits in which to plot (in nm) of the form [x_min, x_max, y_min, y_max].

Type:

List[int], optional

length_units

Amount by which to scale discretisation (which rescales number density).

Type:

float64, optional

max_skyrmion_density

The maximum skyrmion number density to be plotted (corresponds to vmax and -vmin in imshow).

Type:

float64, optional

step

For the quiver plot, how many cells should be skipped between points.

Type:

int, optional

quiver_colour

List of form [R, G, B] for colour of arrows.

Type:

List[float64], optional

quiver_scale

scale option for matplotlib.pyplot.quiver.

Type:

float64, optional

quiver_headwidth

headwidth option for matplotlib.pyplot.quiver.

Type:

float64, optional

quiver_headlength

headlength option for matplotlib.pyplot.quiver.

Type:

float64, optional

quiver_headaxislength

headaxislength option for matplotlib.pyplot.quiver.

Type:

float64, optional

quiver_headlinewidth

headlinewidth option for matplotlib.pyplot.quiver.

Type:

float64, optional

plot()

Plots the magnetization plot.

Returns:

The colour plot if quiver plot not specified; the quiver plot if quiveronly supplied as plot_type; [colour plot, quiver plot] if both specified.

MicromagneticAnalysisTools.Plot.getImpurityArray(directory, impurityColour, zIndex)

Returns an array used to plot the impurity on a colour plot.

Parameters:
  • directory (str) – The directory in which the simulation data is stored.

  • impurityColour (ndarray) – Colour of the impurity, which should be a NumPy array of the form [R, G, B, Alpha].

  • zIndex (int) – The index along the z-axis for which the skyrmion centre should be calculated (for a 3D sample). For a 2D sample, should be 0.

MicromagneticAnalysisTools.Plot.getPinningArray(directory)

Returns an array used to plot the pinned region on a colour plot.

Parameters:

directory (str) – The directory in which the simulation data is stored.

Returns:

Array of regions that are pinned (used to plot pinned region on colour plot with grey overlay).

MicromagneticAnalysisTools.Plot.plotSpeedOverSimulations(directories, currentComponent, speedComponent, COMFileName='COM.npy', ax=None, presentationMethod='legend', showStopRamp=False, timeMultiplier=None, speedMultiplier=None, currentMultiplier=None, colorbarLabel=None)

For a given directory, plot the speeds of the skyrmions in the respective sub-directories.

Parameters:
  • directory (str) – The directory in which the simulation data is stored.

  • currentcomponent (str) – The component of the current to be read. Must be “x”, “y”, or “z”.

  • currentcomponent – The component of the speed to be calculated. Must be “x”, “y”, or “z”.

  • COMFileName (str, optional) – The filename of the NumPy array containing skyrmion centre positions (calculated using e.g. skyrmion COMArray()).

  • ax (matplotlib.axis.Axis) – The Matplotlib axis on which to plot.

  • presentationMethod (str, optional) – The method used to distinguish between different quantites being plotted; either “legend” or “colormap”. For example, say we want to plot skyrmion speed as a function of current for varies damping constants 0.01, 0.02, …, 0.10. We could either have a legend showing the colour for each constant (“legend”), or make the line for 0.01 light and increasingly dark until 0.10 (“colormap”).

  • showStopRamp (bool) – Whether or not to draw a vertical line where the current stops ramping.

  • timeMultiplier (float) – Quantity by which to multiply the times array in seconds (e.g. to convert to dimensionless units).

  • energyMultiplier (float) – Quantity by which to multiply the energy array in Joules (e.g. to convert to dimensionless units).

  • speedMultiplier (float) – Quantity by which to multiply the energy array in m/s (e.g. to convert to dimensionless units).

  • currentMultiplier (float) – Quantity by which to multiply the current array in A (e.g. to convert to dimensionless units), if the quantity being varied for different plots is current

  • colorBarLabel (str) – The label of the colour bar.

MicromagneticAnalysisTools.Plot.vecToRGB(m)

Allows for HLS colour plot of magnetization without having to manually loop pixel-by-pixel. Essentially a vectorised version of colorsys.hls_to_rgb.

Parameters:

directory (str) – The directory in which the simulation data is stored.

Returns:

An array of shape (Nx, Ny, 3), where the final axis is contains the [R, G, B] values.