Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
haeussma committed Oct 25, 2024
1 parent 2b8edcb commit 60a91a4
Show file tree
Hide file tree
Showing 5 changed files with 295 additions and 190 deletions.
23 changes: 20 additions & 3 deletions chromatopy/tools/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,15 @@ def read_agilent(
ChromAnalyzer: ChromAnalyzer object containing the measurements.
"""
from chromatopy.readers.agilent_csv import AgilentCSVReader
from chromatopy.readers.agilent_rdl import AgilentRDLReader
from chromatopy.readers.agilent_txt import AgilentTXTReader

directory = Path(path)

txt_paths = []
csv_paths = []
rdl_paths = []

txt_paths = [
str(f.absolute())
for f in directory.rglob("Report.TXT")
Expand All @@ -500,6 +505,15 @@ def read_agilent(
for f in directory.rglob("RESULTS.CSV")
if f.parent.parent == directory
]
rdl_paths = []

try:
txt_path = next(directory.rglob("*.txt"))
lines = AgilentRDLReader.read_file(str(txt_path))
if lines[0].startswith("┌─────"):
rdl_paths = [str(f.absolute()) for f in directory.rglob("*.txt")]
except StopIteration:
txt_paths = txt_paths

data = {
"dirpath": path,
Expand All @@ -511,10 +525,13 @@ def read_agilent(
"silent": silent,
"mode": mode,
}

if not csv_paths and txt_paths:
if rdl_paths:
data["file_paths"] = rdl_paths # type: ignore
reader = AgilentRDLReader(**data)
measurements = reader.read() # type: ignore
elif not csv_paths and txt_paths:
data["file_paths"] = txt_paths # type: ignore
reader = AgilentTXTReader(**data)
reader = AgilentTXTReader(**data) # type: ignore
measurements = reader.read() # type: ignore
elif csv_paths and not txt_paths:
data["file_paths"] = csv_paths # type: ignore
Expand Down
Loading

0 comments on commit 60a91a4

Please sign in to comment.