Skip to content

Commit

Permalink
Fix up ezchrom.asc
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterKraus committed Apr 6, 2024
1 parent ffb4165 commit 26bb733
Show file tree
Hide file tree
Showing 8 changed files with 63,193 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/yadg/extractors/ezchrom/asc.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ def extract(
for key in ["Version", "Method", "User Name"]:
if line.startswith(key):
k = key.lower().replace(" ", "")
metadata[k] = line.split(f"{key}:")[1].strip()
metadata[k] = line.split(f"{key}:")[1].strip().strip(",")
for key in ["Sample ID"]: # , "Data File"]:
if line.startswith(key):
k = key.lower().replace(" ", "")
metadata[k] = line.split(f"{key}:")[1].strip()
metadata[k] = line.split(f"{key}:")[1].strip().strip(",")
if line.startswith("Acquisition Date and Time:"):
uts = dgutils.str_to_uts(
timestamp=line.split("Time:")[1].strip(),
timestamp=line.split("Time:")[1].strip().strip(","),
format="%m/%d/%Y %I:%M:%S %p",
timezone=timezone,
)
Expand Down
25 changes: 25 additions & 0 deletions tests/test_ezchrom_asc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import pytest
import os
import pickle
from yadg.extractors.ezchrom.asc import extract
from .utils import compare_datatrees


@pytest.mark.parametrize(
"infile",
[
"2023-06-29-007.dat.asc",
"2023-06-29-014.dat.asc",
"230324.dat.asc",
],
)
def test_ezchrom_asc(infile, datadir):
os.chdir(datadir)
ret = extract(fn=infile, encoding="windows-1252", timezone="Europe/Berlin")
outfile = f"ref.{infile}.pkl"
with open(outfile, "rb") as inp:
ref = pickle.load(inp)
print(f"{ret=}")
with open(outfile, "wb") as out:
pickle.dump(ret, out, 5)
compare_datatrees(ret, ref)
Loading

0 comments on commit 26bb733

Please sign in to comment.