You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding the magnetoelastic term to my simulation, reading the generated ODT file would fail because the number of columns returned by ubermagtable.util.columns() would not match the number of columns in the data. Inspecting the code I figured that the YY_ prefix was not considered when splitting the column labels. This patch fixes the issue for me:
diff --git a/ubermagtable/table.py b/ubermagtable/table.py
index 8c4ffbc..6ab6113 100644
--- a/ubermagtable/table.py
+++ b/ubermagtable/table.py
@@ -272,11 +272,7 @@ class Table:
>>> table = ut.Table.fromfile(odtfile, x='t')
"""
- # MagnetoElastic OOMMF extension adds energy twice to data. The
- # following lines are just a way to fix that in the data.
cols = uu.columns(filename, rename=rename)
- if 'MEL_E' in cols:
- cols.insert(cols.index('E'), 'E')
return cls(data=pd.DataFrame(uu.data(filename), columns=cols),
units=uu.units(filename, rename=rename), x=x)
diff --git a/ubermagtable/util/util.py b/ubermagtable/util/util.py
index f87ad86..b2765fb 100644
--- a/ubermagtable/util/util.py
+++ b/ubermagtable/util/util.py
@@ -43,8 +43,8 @@ oommf_dict = {'RungeKuttaEvolve:evolver:Total energy': 'E',
'CGEvolve::Cycle count': 'cycle_count',
'CGEvolve::Cycle sub count': 'cycle_sub_count',
'CGEvolve::Energy calc count': 'energy_calc_count',
- 'CGEvolve:evolver:Energy calc count YY_FixedMEL::Energy':
- 'MEL_E',
+ 'FixedMEL::Energy': 'MEL_E',
+ 'FixedMEL:magnetoelastic:Energy': 'MEL_E',
'SpinTEvolve:evolver:Total energy': 'E',
'SpinTEvolve:evolver:Energy calc count': 'E_calc_count',
'SpinTEvolve:evolver:Max dm/dt': 'max_dmdt',
@@ -183,7 +183,7 @@ def columns(filename, rename=True):
if lines[0].startswith('# ODT'): # OOMMF odt file
cline = list(filter(lambda l: l.startswith('# Columns:'), lines))[0]
- cline = re.split(r'Oxs_|Anv_|Southampton_|My_|UHH_', cline)[1:]
+ cline = re.split(r'Oxs_|Anv_|Southampton_|My_|YY_|UHH_', cline)[1:]
cline = list(map(lambda col: re.sub(r'[{}]', '', col), cline))
cols = list(map(lambda s: s.strip(), cline))
cols_dict = oommf_dict
The text was updated successfully, but these errors were encountered:
Hi @stibus, thank you very much for reporting this bug. Please feel free to contribute to the code by creating a pull request. We would love to acknowledge your contribution by adding you to the contributors' list.
Besides, if there are any extensions you want to have in any of the Ubermag packages, please feel free to contribute.
stibus
added a commit
to stibus/ubermagtable
that referenced
this issue
Jul 4, 2021
When adding the magnetoelastic term to my simulation, reading the generated ODT file would fail because the number of columns returned by
ubermagtable.util.columns()
would not match the number of columns in the data. Inspecting the code I figured that theYY_
prefix was not considered when splitting the column labels. This patch fixes the issue for me:The text was updated successfully, but these errors were encountered: