Table merge#

Multiple OOMMF runs create multiple .odt files. Sometimes, it is necessary to analyse all runs as a single piece of data. Merging tables is achieved using << binary operator.

By merging tables the data from the second operand is appended to the data of the first one. Because independent variable (e.g. time) is always unique for each row, independent variable of the second operand is increased by the maximum value of the first one. If tables have non-matching columns, Nan will be added to missing data.

As an example, let us merge two tables:

[1]:
import os

import ubermagtable as ut

# Sample .odt file
dirname = os.path.join("..", "ubermagtable", "tests", "test_sample")
odtfile1 = os.path.join(dirname, "oommf-old-file1.odt")
odtfile2 = os.path.join(dirname, "oommf-old-file2.odt")

table1 = ut.Table.fromfile(odtfile1, x="t")
table2 = ut.Table.fromfile(odtfile2, x="t")

Time time interval of table1 is:

[2]:
table1.xmax
[2]:
2.4999999999999994e-11

and of table2 is

[3]:
table2.xmax
[3]:
1.5e-11

Accordingly we expect that the length of the time interval would be the sum of those two. Let us now merge two tables:

[4]:
merged_table = table1 << table2

The time interval length of the resulting table is:

[5]:
merged_table.xmax
[5]:
3.999999999999999e-11

as we expected. The final thing we want to check is the the time column in the merged table is monotonically increasing:

[6]:
merged_table.data["t"]
[6]:
0     1.000000e-12
1     2.000000e-12
2     3.000000e-12
3     4.000000e-12
4     5.000000e-12
5     6.000000e-12
6     7.000000e-12
7     8.000000e-12
8     9.000000e-12
9     1.000000e-11
10    1.100000e-11
11    1.200000e-11
12    1.300000e-11
13    1.400000e-11
14    1.500000e-11
15    1.600000e-11
16    1.700000e-11
17    1.800000e-11
18    1.900000e-11
19    2.000000e-11
20    2.100000e-11
21    2.200000e-11
22    2.300000e-11
23    2.400000e-11
24    2.500000e-11
25    2.600000e-11
26    2.700000e-11
27    2.800000e-11
28    2.900000e-11
29    3.000000e-11
30    3.100000e-11
31    3.200000e-11
32    3.300000e-11
33    3.400000e-11
34    3.500000e-11
35    3.600000e-11
36    3.700000e-11
37    3.800000e-11
38    3.900000e-11
39    4.000000e-11
Name: t, dtype: float64