Use¶
This section describes how to install a pyRat wheel built in Build into a Python environment, get started with the examples, and define magnetic simulations.
Once installed (see Install), the pyrat Python
module gives access to all submodules described in
Module pyrat. The general use case import statement
is the following:
# Rat namespaces and objects (e.g. rat.cmn.Gauss, rat.mdl.Model, ...)
from pyrat import rat
# Colors into global namespace (e.g. KRED, KYEL, KNRM, ...)
from pyrat.col import *
Rat can now be invoked from Python code through
the rat submodule to run magnetic simulations,
and the col submodule exposes ANSI escape
sequences for colors to the global namespace
for easy message formatting when logging results.
Inspiration can be drawn from the several pyRat examples or directly from the original Project-Rat repositories and their examples subdirectories.
Caution
pyRat is still under active development and might lack some functionalities from original Rat C++ libraries for now.