5. Visualization and evaluation#
This chapter provides documentation on how to visualize and evaluate data.
5.1. Sample and experimental setup visualization#
At the moment, samples and experimental setups can be inspected with
>>> sample.show()
>>> exp.show()
which will display a 3D view using the k3d package.
- tetrax.core.sample.AbstractSample.show(self, show_node_labels=False, show_mag=True, comp='vec', scale=5, show_scaled_mag=True, show_grid=False, show_extrusion=True)#
Show the sample. Displays the mesh and, if available, the magnetization(s).
- Parameters
- show_node_labelsbool
If true, shows the label associated to each node.
- show_magbool
Show the magnetization (or magnetizations, in the case of antiferromagnetic samples).
- comp{“vec”, “x”, “y”, “z”}
Determines which component will be plotted.
- scale
float
Determines the scale of the vector glyphs used to visualize the magnetization (default is 5).
- show_scaled_magbool
Scale magnetization with spatially dependent saturation magnetization (default is
True
).- show_gridbool
Show background grid (default is
False
).- show_extrusionbool
Show full 3D mesh by extruding 1D or 2D mesh (default is
True
).
- Returns
- plot
k3d_plot_object
- plot
- tetrax.core.experimental_setup.ExperimentalSetup.show(self, comp='vec', scale=5, show_antenna=True, show_grid=False, show_extrusion=True)#
Shows the experimental setup, including external fields and microwave antennna.
- Parameters
- comp{“vec”, “x”, “y”, “z”}
If external field is nonzero, determines which component will be plotted.
- scale
float
Determines the scale of the vector glyphs used to visualize the magnetization (default is 5).
- show_antennabool
If available, show the microwave antenna (default is
True
).- show_gridbool
Show grid lines in plot (default is
False
).- show_extrusionbool
Show full 3D mesh by extruding 1D or 2D mesh (default is
True
).
5.2. Scalar- and vectorfield visualization#
It is also possible to plot scalar fields or vector fields defined on a given sample using the plot()
method of a sample.
>>> vector_field = tx.vectorfields.helical(sample.xyz, 90, 1)
>>> sample.plot(vector_field)
- tetrax.core.sample.AbstractSample.plot(self, fields, comp='vec', scale=5, labels=None)#
Plot a vector or scalar field which is defined on each node of the mesh. Multiple fields can be plotted at the same time.
- Parameters
- fields
numpy.array
orlist
(numpy.array
) Scalar field of shape (nx,), vector field of shape (nx,3) or list containing any choice of the aforementioned.
- comp{“vec”, “x”, “y”, “z”}
If field is a vector field, this parameter determines which component will be plotted.
- scale
float
Determines the scale of the vector glyphs used to visualize a vectorfield (default is 5).
- labels
str
orlist
(str
) Label(s) of the vectorfield(s) to be plotted. If
labels
is a list, it needs to have the same length asfields
(default isNone
).
- fields
5.3. Mode visualization#
The calculated modes can be shown in the notebook using the show_mode()
.
The mode will be visualized as a vectorfield colored according to its magnitute, dark and bright colors represent low and high amplitudes, respectively.
The mode can be visualized as the dynamic component only or as a mode on the top of the equilibrium magnetization.
The mode can be visualized with the following command:
>>> exp.show_mode(k=10,N=1,periods=10,on_equilibrium=True,animated=True,scale=10,fps=30,scale_mode=2)
This will show the animated mode movie of the mode N=1 for k=10 rad/µm wave vector, on the top of the equilibrium, for 10 periods with 30 frames per second.
The magnetization vectorfield can be scaled by the scale
parameter and the amplitude of the dynamic component with the scale_mode
parameter.
Here is an example for a magnetostatic surface wave in a 50 nm permalloy film in the Damon-Eshbach geometry.
For details of the mode animation check the method:
- tetrax.core.experimental_setup.ExperimentalSetup.show_mode(self, k=0, N=0, scale=1, on_equilibrium=True, animated=False, periods=1, frames_per_period=20, fps=12, scale_mode=1)#
If spatial mode profiles are available, show a desired mode.
The mode is visualized as vector field which can either only show the dynamic component or the full magnetization (mode on-top of equilibrium). Setting
animated=True
allows to animate the mode profiles by showing the oscillation over a desired number of periods (default is 1). The mode is automatically colored according to its magnitude.Warning
At the moment, animation is implemented such that it will play until the end and cannot be stopped (except by interrupting the kernel). So be careful with setting a large number of oscillation periods.
- Parameters
- k
float
, optional Wave vector of desired mode in rad/µm (default is 0). This parameter will be ignored for confined samples.
- N
int
, optional Mode/branch index of mode to be shown (default is 0).
- scale
float
, optional Scaling of the mode (default is 1).
- on_equilibriumbool, optional
If true, show the mode on top of the equilibrium magnetization (default is True).
- animatedbool, optional
Make a mode movie by showing the magnetic oscillation over one period in a loop.
- periods
int
, optional Number of oscillation periods to animate (default is 1). Will be ignored if
animated=False
.- frames_per_period
int
, optional Number of frames to animate per period (default is 20). Will be ignored if
animated=False
.- fps
int
, optional Frames per second for animation (default is 12).
- k
5.4. Average and data extraction#
In order to calculate the average of a given vector or scalar field on a sample,
one can use the average()
method
of the respective sample.
- tetrax.core.sample.AbstractSample.average(self, field)#
Calculate the average of a scalar of vector field within the given sample.
Extracting data of vector or scalar fields along a line or curve is possible with
the scan_along_curve()
method of the sample.
- tetrax.core.sample.AbstractSample.scan_along_curve(self, field, curve, num_points=100, return_curve=False)#
Interpolate a given scalar or vector field along a specified curve.
- Parameters
- field
MeshScalar
orMeshVector
Field to be interpolated.
- curve
ndarray
,shape
(nx
, 3) or tuple/list ofshape
(2, 3) The points along the interpolation curve or the start and end points of the curve
((x1, y1, z1),(x2, y2, z2))
.- num_points
int
The number of points to interpolate along the curve. Will only be considered if start and end points are given (default is 100).
- return_curvebool
Next to the interpolated values, also return the interpolation curve.
- field
- Returns
- interp_values
ndarray
,shape
(num_points
,m
) The interpolated values along the curve with
m
being the size of the second dimension offield
.
- interp_values
Examples