ubermagtable.util.units#

ubermagtable.util.units(filename, rename=True)#

Extracts units for individual columns from a table file.

This method extracts both column names and units and returns a dictionary, where keys are column names and values are the units.

Parameters:
  • filename (str) – OOMMF .odt or mumax3 .txt file.

  • rename (bool) – If rename=True, the column names are renamed with their shorter versions. Defaults to True.

Returns:

Dictionary of column names and units.

Return type:

dict

Examples

  1. Extracting units for individual columns from an OOMMF .odt file.

>>> import os
>>> import ubermagtable.util as uu
...
>>> odtfile = os.path.join(os.path.dirname(__file__), '..',
...                        'tests', 'test_sample', 'oommf-new-file2.odt')
>>> uu.units(odtfile)
{...}
  1. Extracting units for individual columns from a mumax3 .txt file.

>>> odtfile = os.path.join(os.path.dirname(__file__), '..',
...                        'tests', 'test_sample', 'mumax3-file1.txt')
>>> uu.units(odtfile)
{...}