Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
User can now pass quiver arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
RossKnapman committed Mar 4, 2023
1 parent ef6d430 commit 3f53042
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
20 changes: 16 additions & 4 deletions MicromagneticAnalysisTools/Animate.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,16 @@ def __init__(self,
limits=None,
length_units=None,
step=1,
quiver_colour=[1., 1., 1.],
start_file = None,
end_file = None,
rectangle_fracs = None,
out_name = None):
out_name = None,
quiver_colour = [1., 1., 1.],
quiver_scale = 1.,
quiver_headwidth = 6,
quiver_headlength = 10,
quiver_headaxislength = 10,
quiver_linewidth = 5):
self.plot_type = plot_type
self.directory = directory
self.fig = fig
Expand All @@ -144,11 +149,16 @@ def __init__(self,
self.limits = limits
self.length_units = length_units
self.step = step
self.quiver_colour = quiver_colour
self.start_file = start_file
self.end_file = end_file
self.rectangle_fracs = rectangle_fracs
self.out_name = out_name
self.quiver_colour = quiver_colour
self.quiver_scale = quiver_scale
self.quiver_headwidth = quiver_headwidth
self.quiver_headlength = quiver_headlength
self.quiver_headaxislength = quiver_headaxislength
self.quiver_linewidth = quiver_linewidth

self.files_to_scan = Read.getFilesToScan(self.directory, self.start_file, self.end_file)
assert len(self.files_to_scan) != 0
Expand Down Expand Up @@ -176,7 +186,9 @@ def __init__(self,
ax=self.ax, z_index=self.z_index, component=self.component, plot_quiver=self.plot_quiver,
plot_impurity=self.plot_impurity, plot_pinning=self.plot_pinning, show_component=self.show_component,
interpolation=self.interpolation, limits=self.limits, length_units=self.length_units, step=self.step,
quiver_colour=self.quiver_colour)
quiver_colour=self.quiver_colour, quiver_scale=self.quiver_scale, quiver_headwidth=self.quiver_headwidth,
quiver_headlength=self.quiver_headlength, quiver_headaxislength=quiver_headaxislength,
quiver_linewidth=self.quiver_linewidth)

if self.plot_quiver:
if plot_type == 'quiveronly':
Expand Down
20 changes: 18 additions & 2 deletions MicromagneticAnalysisTools/Plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ class MagnetizationPlotter:
max_skyrmion_density(float64, optional): The maximum skyrmion number density to be plotted (corresponds to vmax and -vmin in `imshow`).
step (int, optional): For the quiver plot, how many cells should be skipped between points.
quiver_colour (List[float64], optional): List of form `[R, G, B]` for colour of arrows.
quiver_scale (float64, optional): scale option for matplotlib.pyplot.quiver.
quiver_headwidth (float64, optional): headwidth option for matplotlib.pyplot.quiver.
quiver_headlength (float64, optional): headlength option for matplotlib.pyplot.quiver.
quiver_headaxislength (float64, optional): headaxislength option for matplotlib.pyplot.quiver.
quiver_headlinewidth (float64, optional): headlinewidth option for matplotlib.pyplot.quiver.
"""

Expand All @@ -179,7 +184,12 @@ def __init__(self,
length_units=None,
max_skyrmion_density=None,
step=1,
quiver_colour=[0, 0, 0]):
quiver_colour=[0, 0, 0],
quiver_scale=3.,
quiver_headwidth=10,
quiver_headlength=20,
quiver_headaxislength=20,
quiver_linewidth=5):
self.plot_type = plot_type
self.directory = directory
self.plot_file = plot_file
Expand All @@ -196,6 +206,11 @@ def __init__(self,
self.max_skyrmion_density = max_skyrmion_density
self.step = step
self.quiver_colour = quiver_colour
self.quiver_scale = quiver_scale
self.quiver_headwidth = quiver_headwidth
self.quiver_headlength = quiver_headlength
self.quiver_headaxislength = quiver_headaxislength
self.quiver_linewidth = quiver_linewidth

self.Lx, self.Ly = Read.sampleExtent(self.directory)
self.m_array = df.Field.fromfile(self.directory + '/' + self.plot_file).array
Expand Down Expand Up @@ -287,7 +302,8 @@ def _plot_quiver(self):
colour_array = self._get_quiver_colour_array(magnetization_array)
self.quiver_plot = self.ax.quiver(Y.T, X.T, magnetization_array[:, :, 0].T / in_plane_magnitude,
magnetization_array[:, :, 1].T / in_plane_magnitude, color=colour_array, units='xy', scale_units='xy', pivot='mid',
headwidth=6, headlength=10, headaxislength=10, linewidth=5)
scale=self.quiver_scale, headwidth=self.quiver_headwidth, headlength=self.quiver_headlength, headaxislength=self.quiver_headaxislength,
linewidth=self.quiver_linewidth)

def _plot_impurity(self):
impurity_array = np.flip(getImpurityArray(self.directory, np.array([0, 1, 0, 0.2]), self.z_index)[
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="MicromagneticAnalysisTools",
version="0.0.12",
version="0.0.13",
description="A collection of tools to analyse data from MuMax3.",
author="Ross Knapman",
author_email="[email protected]",
Expand Down

0 comments on commit 3f53042

Please sign in to comment.