# GURU — `guru-tsv-cat` Manual (EN)

**Purpose.**
- Concatenate multiple TSVs while keeping a single header (union of columns).
- Build a rectangular EOS grid TSV for grid‑based solvers (`guru-isentrope`, `guru-hugoniot`) from scattered TSV rows.

---

## Synopsis
```bash
# Concatenate (default)
guru-tsv-cat -o merged.tsv file1.tsv file2.tsv [file3.tsv ...]

# Build rectangular grid TSV from scattered points
guru-tsv-cat --mode grid -o grid.tsv inputs/*.tsv \
  [--tol-T dT] [--tol-rho dR] [--min-cover-frac f]
```

**Modes**
- `cat` — union of columns across inputs; missing cells left blank; a single header is written.
- `grid` — reads rows with `T, rho, P, E`/`E_atom` from one or more TSVs, clusters `T` and `rho` by tolerances into a rectangular grid, checks coverage, fills a few missing cells by local interpolation, and writes a grid TSV with columns `T  rho  P  E_atom`.

Options (grid)
- `--tol-T`, `--tol-rho` — absolute tolerances for clustering unique T and rho (default: 1e-6 K, 1e-9 g/cm³).
- `--min-cover-frac` — minimal coverage fraction `#present / (|T|*|rho|)` to accept grid inference (default: 0.7).

**Examples**
```bash
# Concatenate stats with different headers (union of columns)
guru-tsv-cat -o all_T300.tsv T300_part1.tsv T300_part2.tsv

# Prepare rectangular grid from scattered thermo TSVs
guru-tsv-cat --mode grid -o EOS_grid.tsv thermo/*.tsv --tol-T 5 --tol-rho 0.01
```

**Troubleshooting**
- Grid inference fails with “coverage too sparse” — provide more points so that at least `min-cover-frac` of the T×rho cells are present.
- Units: expected `T [K]`, `rho [g/cm^3]`, `P [kbar]`, `E [eV/atom]` (or `E_atom`).
