OOMMFDrive#

class micromagneticdata.OOMMFDrive(name, number, dirname='.', x=None, use_cache=False, **kwargs)#

Drive class for OOMMFDrives (created automatically).

This class provides utility for the analysis of individual OOMMF drives. It should not be created explicitly. Instead, use micromagneticdata.Drive which automatically creates a drive object of the correct sub-type.

Parameters:
  • name (str) – System’s name.

  • number (int) – Drive number.

  • dirname (str, optional) – Directory in which system’s data is saved. Defults to './'.

  • x (str, optional) – Independent variable column name. Defaults to None and depending on the driver used, one is found automatically.

  • use_cache (bool, optional) – If True the Drive object will read tabular data and the names and number of magnetisation files only once. Note: this prevents Drive to detect new data when looking at the output of a running simulation. If set to False the data is read every time the user accesses it. Defaults to False.

Raises:

IOError – If the drive directory cannot be found.

Examples

  1. Getting drive object.

>>> import os
>>> import micromagneticdata as md
...
>>> dirname = os.path.join(os.path.dirname(__file__), 'tests', 'test_sample')
>>> drive = md.Drive(name='rectangle', number=0, dirname=dirname)

Methods

__dir__

Default dir() implementation.

__eq__

Return self==value.

__getitem__

Magnetisation field of an individual step or subpart of the drive.

__iter__

Iterator.

__lshift__

Concatenate multiple drives of the same type.

__repr__

Representation string.

ovf2vtk

OVF to VTK conversion.

register_callback

Register a callback to which a field is passed before being returned.

slider

Widget for selecting individual steps.

to_xarray

Export micromagneticdata.Drive as xarray.DataArray

Properties

calculator_script

MIF file.

callbacks

Return all registered callbacks.

dirname

Descriptor allowing setting attributes only with values of a certain type.

hv

Plot interface, Holoviews/hvplot based.

info

Drive information.

m0

Inital magnetisation.

n

Number of steps.

name

Descriptor allowing setting attributes only with values of a certain type.

number

Descriptor allowing setting attributes only with scalars (numbers.Real).

table

Table object.

use_cache

Use caching for scalar data and the list of magnetisation files.

x

Independent variable name.


__repr__()#

Representation string.

Returns:

Representation string.

Return type:

str

Examples

  1. Representation string.

>>> import os
>>> import micromagneticdata as md
...
>>> dirname = os.path.join(os.path.dirname(__file__), 'tests', 'test_sample')
>>> drive = md.Drive(name='rectangle', number=0, dirname=dirname)
>>> drive
OOMMFDrive(name='rectangle', number=0, dirname='...test_sample', x='t')
property calculator_script#

MIF file. This property returns a string with the content of MIF file.

Returns:

MIF file content.

Return type:

str

Examples

  1. Getting MIF file.

>>> import os
>>> import micromagneticdata as md
...
>>> dirname = os.path.join(os.path.dirname(__file__), 'tests', 'test_sample')
>>> drive = md.Drive(name='rectangle', number=6, dirname=dirname)
>>> drive.calculator_script
'# MIF 2...'
  1. Getting mx3 file

TODO add mumax3 output to the pre-computed data

property x#

Independent variable name.

Parameters:

value (str) – Independent variable name.

Returns:

Representation string.

Return type:

str

Raises:

ValueError – If the column name does not exist in table.

Examples

  1. Getting and setting independent variable name.

>>> import os
>>> import micromagneticdata as md
...
>>> dirname = os.path.join(os.path.dirname(__file__), 'tests', 'test_sample')
>>> drive = md.Data(name='hysteresis', dirname=dirname)[0]
>>> drive.x
'B_hysteresis'
>>> drive.x = 'Bx_hysteresis'