Skip to content
deryahazalPublic

About

Convert instrument text exports into a standard, unit-checked table and trace every value back to its source line.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

LabCSV

DOI

Instrument exports in, SI units out, every value traced to its source line.

LabCSV converts text exports from laboratory instruments into one standard table. The decisions you make on the first file (columns, units, decimal mark) are saved as a template. Later files are converted only while they still match. If anything changed, LabCSV stops and tells you why.

$ labcsv convert examples/demo_a/run1_semicolon.csv \
      --template templates/ec-semicolon-ms-mV-mA.v1.json --out review/
converted     run1_semicolon.csv  -> run1_semicolon.csv (3 points)

$ labcsv convert changed.csv --template templates/ec-semicolon-ms-mV-mA.v1.json --out review2/
needs_review  changed.csv  template does not fit: columns missing from the file: ['I/mA'] (+1 more)

Context

LabCSV comes from my work with electrochemical measurements and UV-Vis spectra, where the small decisions made while preparing a file for analysis can change the result. It turns that experience into software that other laboratories can use with their own instrument exports.

Why

A current read in mA instead of A is off by a factor of 1000. A voltammogram sorted by potential loses its scan order. Neither mistake raises an error. LabCSV makes these decisions explicit and refuses to repeat them silently.

What it will not guess

  • a decimal mark the file does not decide (1,234)
  • a thousands separator
  • a unit outside its unit table
  • a table shorter than it declares (CURVE TABLE 5258 with 10 rows)
  • a changed setup in a Gamry file (experiment type, current convention, IR compensation)
  • a point the instrument flagged as an error (Gamry Over column)

Such files end as needs_review, with the reason and the source line.

What you get

For each file:

  • run1.csv with time_s, potential_V, current_A, the source line of every row and the original order
  • run1.provenance.json with the source SHA-256, template version, unit factors, decimal mark and where each decision came from

For each run: summary.csv.

Quick start

python -m pip install -e .
labcsv inspect examples/demo_a/run3_tab.tsv
labcsv make-template examples/demo_a/run3_tab.tsv \
    --map time_s=t --map potential_V=E --map current_A=I --out my-export.v1.json
labcsv check examples/demo_a/run3_tab.tsv --template my-export.v1.json     # dry run, writes nothing
labcsv convert examples/demo_a/run3_tab.tsv --template my-export.v1.json --out review/

Python 3.10 or later. No dependencies outside the standard library.

Supported

Input Scope
Generic CSV / TSV one table; , ; or tab; . or , decimal mark; optional unit row
Gamry Framework DTA chronoamperometry and cyclic voltammetry; one or more CURVE tables

Status

Alpha. Tested on synthetic files and public Gamry test files, and cross-checked row by row against an independent reader (gamry-parser); not yet validated on complete laboratory exports. Details: supported exports, output format, templates, contributing.

License

Code: MIT. Example data: CC BY 4.0. Third-party test files keep their own licenses (see tests/fixtures/gamry_parser/NOTICE). How to cite: CITATION.cff, archived on Zenodo as doi:10.5281/zenodo.24710853.

About

Convert instrument text exports into a standard, unit-checked table and trace every value back to its source line.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages