llg3d.post.x_profiles¶
Plot x-profiles of magnetization from a result file.
Use the llg3d.x_profiles command line tool to plot the x-profiles of magnetization
from a result file:
$ llg3d.x_profiles -h
usage: llg3d.x_profiles [-h] [-i IMAGE_FILEPATH] [-s] [-t TIME] [-m {1,2,3}]
file
Plot x-profiles of magnetization from a result file.
positional arguments:
file Path to the result file.
options:
-h, --help show this help message and exit
-i IMAGE_FILEPATH, --image_filepath IMAGE_FILEPATH
Path to save the image (default: x_profile.png)
-s, --show Display the plot (omit to disable display in non-
interactive runs). (default: False)
-t TIME, --time TIME Slice for time steps (e.g., '-5:' for last 5, '::10'
for every 10th). (default: :)
-m {1,2,3}, --m_index {1,2,3}
Index of the magnetization component to plot (1, 2, or
3). (default: 1)
See here for how to generate the run.npz file
used in this example.
When calling the tool on a result file:
$ llg3d.x_profiles run.npz -m 1 -t ::4 -i x_profiles_4.png
Written to x_profiles_4.png
Functions
|
Parse command-line arguments for post-processing scripts. |
|
Parse CLI arguments and call the plot function. |
|
Parse a string representation of a slice into a slice object. |
|
Plot the results from the given files. |
- parse_slice(slice_str)[source]¶
Parse a string representation of a slice into a slice object.
Handles formats like ‘start:stop:step’, ‘start:stop’, ‘:stop’, ‘::step’, etc.
- Parameters:
slice_str (str) – String representation of the slice.
- Returns:
A slice object corresponding to the input string.
- Return type:
slice
- plot_x_profiles(file, image_filepath=None, show=False, time_slice=':', m_index=0)[source]¶
Plot the results from the given files.
- Parameters:
file (Path) – Path to the result file.
image_filepath (Path | str | None) – Path to the output image file. if None, the image will not be saved.
show (bool) – display the graph in a graphical window.
time_slice (str) – String representing the time slice to plot (e.g. “:-5”, “::10”).
m_index (int) – Index of the magnetization component to plot (0, 1, or 2).
- get_cli_args(description, default_image_filepath)[source]¶
Parse command-line arguments for post-processing scripts.
- Parameters:
description (str | None) – Description of the script for the help message.
default_image_filepath (Path) – Default path to save the output image.
- Returns:
Parsed command-line arguments.
- Return type:
Namespace