# GURU — prop-along (guru-prop-along)

Interpolate an arbitrary property Q(T, rho) (e.g., electrical conductivity sigma, viscosity) on an EOS-like grid and append it along a given T–rho path (e.g., isentrope TSV).

## Purpose
- Input 1 (grid): one or more TSVs with columns T, rho, and the target property (column name given by `--prop`). Accepts compact or rich guru-thermo TSVs; header names are matched case-insensitively with synonyms.
- Input 2 (path): a TSV with columns T and rho (e.g., output of `guru-isentrope`).
- Output: original path TSV plus one appended column with the interpolated property values along the path.

## Grid handling
- `--grid-mode auto|rect|quasi`
  - rect: build RectBivariateSpline on a rectangular T×rho grid (exact interpolation).
  - quasi: build SmoothBivariateSpline on scattered (T, rho) points with smoothing factor `--smooth-s` (`s=0` ⇒ interpolation).
  - auto (default): detect rectangularity (same number of rows per rho). Falls back to quasi otherwise.
- Missing values: if some grid points lack the property, quasi mode uses the surrounding points; in rect mode, rectangularity is required; otherwise auto switches to quasi.
- Extrapolation: allow up to ±`--extrap-frac` beyond grid bounds (warn once), leave blank outside this window.

## CLI
```
guru-prop-along \
  -g grid.tsv [grid2.tsv ...] --prop <name> [<name2> ...] \
  --path path.tsv -o out.tsv \
  [--grid-mode auto|rect|quasi] [--smooth-s 0.0] [--extrap-frac 0.10] \
  [--prop-out name ...] [--plot] [--plot-prefix prefix]
```

- `-g/--grid`: EOS-like TSV(s) containing columns T and rho and the desired property.
- `--prop`: property column name(s), one or more (case-insensitive). Fallback: match by substring.
- `--path`: TSV with columns T and rho (and optionally P).
- `-o/--out`: output TSV with the property column(s) appended (column names `--prop-out` if provided, otherwise names from `--prop`).
- `--grid-mode`: see above. `--smooth-s` controls smoothing for quasi mode.
- `--extrap-frac`: allowed extrapolation if the path goes beyond grid bounds (default ±10%).
- `--plot`: save PNG plots along the path: Q–rho and Q–T.
- `--plot-prefix`: prefix for plot files (default: derived from `--out`).
  Q–P is saved automatically when `--plot` is set and the path contains a pressure column.

## Column name mapping (case-insensitive)
- T: `T`, `T_mean`, or any header starting with `t` (e.g., `T[K]`).
- rho: `density_g_cm3`, `rho`, `d`, or any header starting with `rho` or `dens`.
- P (optional in path): `P`, `P_mean`, or any header starting with `p` (e.g., `P[kbar]`).
- Q: exact match for `--prop`; fallback: first header that contains the substring.

## Examples
- Conductivity along an isentrope (rich TSV + plots):
```
guru-prop-along -g thermo_rich.tsv --prop sigma \
  --path iso.tsv -o iso_with_sigma.tsv \
  --plot --plot-prefix iso_sigma
```
- Multiple properties (sigma and viscosity) from a scattered grid with smoothing and Q–P plot:
```
guru-prop-along -g eos_scattered.tsv --prop sigma viscosity \
  --grid-mode quasi --smooth-s 1.5 \
  --path iso.tsv -o iso_with_props.tsv \
  --plot --plot-prefix iso_props
```

## Outputs
- `out.tsv`: original path with the appended property column(s).
- Plots when `--plot` is used (Q–P saved automatically if P is present in the path):
  - `<prefix>_<Q>_rho.png` — Q vs rho
  - `<prefix>_<Q>_T.png` — Q vs T
  - `<prefix>_<Q>_P.png` — Q vs P (if path has pressure)
