Abstract#

class micromagneticmodel.abstract.Abstract(**kwargs)#

Abstract class for deriving all terms, drivers, and evolvers.

It can be initialised with keyword arguments defined in _allowed_attributes, which is a list of strings.

Raises:

AttributeError – If a keyword argument not in _allowed_attributes is passed.


Methods

__dir__

Default dir() implementation.

__eq__

Return self==value.

__iter__

Iterator.

__repr__

Representation string.

Properties

name

Name.


__iter__()#

Iterator.

It yields all defined attributes and their values.

Examples

  1. Iterating through all defined attributes and their values.

>>> import micromagneticmodel as mm
...
>>> exchange = mm.Exchange(A=1)
>>> for attr, value in exchange:
...     print(f'{attr} = {value}')
A = 1
__repr__()#

Representation string.

Returns:

Representation string.

Return type:

str

Examples

  1. Getting representation string.

>>> import micromagneticmodel as mm
...
>>> exchange = mm.Exchange(A=1e-12)
>>> repr(exchange)
'Exchange(A=1e-12)'
>>> damping = mm.Damping(alpha=0.01)
>>> repr(damping)
'Damping(alpha=0.01)'
property name#

Name.

If the name was not provided during initialisation, the name of the object is the same as the name of the class in lowercase.

Returns:

Name.

Return type:

str

Examples

  1. Getting names.

>>> import micromagneticmodel as mm
...
>>> ua = mm.UniaxialAnisotropy(K=5e6, u=(0, 0, 1))
>>> ua.name
'uniaxialanisotropy'
>>> damping = mm.Damping(alpha=0.01, name='my_damping')
>>> damping.name
'my_damping'