CombinedDrive#

class micromagneticdata.CombinedDrive(*drives, **kwargs)#

Drive class for stacked drives.

This class provides utility for the analysis of individual drives.

Parameters:
  • drives (List[Drive]) –

  • kwargs – Additional keyword arguments that are passed to AbstractDrive()

Raises:
  • ValueError – If the drives have different independent variables or less than two drives are passed.

  • TypeError – If the passed objects are not of type micromagneticdata.Drive.

Examples

  1. Getting drive object.

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

Methods

__dir__

Default dir() implementation.

__eq__

Return self==value.

__getitem__

Magnetisation field of an individual step.

__iter__

Iterator.

__lshift__

Concatenate multiple drives of the same type.

__repr__

Representation string.

register_callback

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

to_xarray

Export micromagneticdata.Drive as xarray.DataArray

Properties

callbacks

Return all registered callbacks.

hv

Plot interface, Holoviews/hvplot based.

info

Drive information.

m0

Inital magnetisation.

n

Number of steps.

table

Table object.

x

Independent variable name.


__lshift__(other)#

Concatenate multiple drives of the same type.

Multiple drives with the same independent variable (typically drives of the same type, e.g. TimeDriver) can be concatenated into one combined drive. The resulting object has one large table with scalar values and allows iterating over all magnetisation files of the individual drives.

Parameters:

other (micromagneticdata.Drive, micromagneticdata.CombinedDrive) – The drive to append to the current object.

Returns:

The concatenated drives.

Return type:

micromagneticdata.CombinedDrive

Examples

  1. Concatenating two drives

>>> import os
>>> import micromagneticdata as md
...
>>> dirname = dirname=os.path.join(os.path.dirname(__file__),
...                                'tests', 'test_sample')
>>> drive_0 = md.Drive(name='system_name', number=0, dirname=dirname)
>>> drive_1 = md.Drive(name='system_name', number=1, dirname=dirname)
>>> drive_0 << drive_1
CombinedDrive...
__repr__()#

Representation string.

Returns:

Representation string.

Return type:

str

Examples

  1. Representation string.

>>> import os
>>> import micromagneticdata as md
...
>>> dirname = dirname=os.path.join(os.path.dirname(__file__),
...                                'tests', 'test_sample')
>>> drive = md.Drive(name='system_name', number=0, dirname=dirname)
>>> drive
OOMMFDrive(...)
register_callback(callback)#

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

property info#

Drive information.

This property returns a dictionary with information about the drive.

Returns:

Drive information.

Return type:

dict

Examples

  1. Getting information about drive.

>>> import os
>>> import micromagneticdata as md
...
>>> dirname = dirname=os.path.join(os.path.dirname(__file__),
...                                'tests', 'test_sample')
>>> drive = md.Drive(name='system_name', number=6, dirname=dirname)
>>> drive.info
{...}
property table#

Table object.

This property returns an ubermagtable.Table object. As an independent variable x, the column chosen via x property is selected.

Returns:

Table object.

Return type:

ubermagtable.Table

Examples

  1. Getting table object.

>>> import os
>>> import micromagneticdata as md
...
>>> dirname = dirname=os.path.join(os.path.dirname(__file__),
...                                'tests', 'test_sample')
>>> drive = md.Drive(name='system_name', number=0, dirname=dirname)
>>> drive.table  
E...
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 = 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'