Skip to content

Commit

Permalink
WAIT technique bugfix (#88)
Browse files Browse the repository at this point in the history
* Bugfix

* Properly defaulting E_range

* Testing

Co-authored-by: Nicolas Vetsch <[email protected]>
  • Loading branch information
2 people authored and PeterKraus committed Oct 7, 2022
1 parent 075f170 commit 0e8c911
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/yadg/parsers/electrochem/eclabmpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,9 @@ def _process_modules(contents: bytes) -> tuple[dict, list, list, dict, dict]:
Eranges = []
Iranges = []
for el in params:
Eranges.append(el["E_range_max"] - el["E_range_min"])
E_range_max = el.get("E_range_max", float("inf"))
E_range_min = el.get("E_range_min", float("-inf"))
Eranges.append(E_range_max - E_range_min)
Iranges.append(el.get("I_range", "Auto"))
elif name == "VMP data":
data = _process_data(module_data, header["version"], Eranges, Iranges)
Expand Down
4 changes: 3 additions & 1 deletion src/yadg/parsers/electrochem/eclabmpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,9 @@ def process(
Eranges = []
Iranges = []
for el in params:
Eranges.append(el["E_range_max"] - el["E_range_min"])
E_range_max = el.get("E_range_max", float("inf"))
E_range_min = el.get("E_range_min", float("-inf"))
Eranges.append(E_range_max - E_range_min)
Iranges.append(el.get("I_range", "Auto"))
data = _process_data(data_lines, Eranges, Iranges)
# Arrange all the data into the correct format.
Expand Down
26 changes: 26 additions & 0 deletions tests/test_electrochem.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,32 @@ def test_datagram_from_eclab(input, ts, datadir):
pars_datagram_test(ret, ts)


@pytest.mark.parametrize(
"input, ts",
[
(
{ # ts0 - wait.mpr
"case": "wait.mpr",
"encoding": "windows-1252",
"parameters": {"filetype": "eclab.mpr"},
},
"ca_data.json",
),
(
{ # ts1 - wait.mpt
"case": "wait.mpt",
"encoding": "windows-1252",
"parameters": {"filetype": "eclab.mpt"},
},
"ca_data.json",
),
],
)
def test_datagram_wait_technique(input, ts, datadir):
ret = datagram_from_input(input, "electrochem", datadir)
assert not ret["steps"][0]["data"], "No data should be present."


@pytest.mark.parametrize(
"input, refpath",
[
Expand Down

0 comments on commit 0e8c911

Please sign in to comment.