File Saving
The save command exports processed data to text files. It supports two modes:
columns- export selected expressions for each page into separate filestable- export one shared axis with one column per page into a single table file
Basic Usage
save columns --path <path-template> --columns <expr1> [<expr2> ...] [options]
save table --path <path-template> --axis <axis-expr> --column <data-expr> [options]
Modes Overview
| Mode | Output pattern | Typical use |
|---|---|---|
columns | One file per page | Save processed columns (e.g. k, chi, expressions) |
table | One file per target path, with one column per page | Build comparison tables for plotting/analysis outside EstraPy |
Save columns
Exports one file for each page. Each file contains the requested expression columns evaluated on that page.
save columns --path <path-template> --columns <expr1> [<expr2> ...] [options]
Options
| Option | Description |
|---|---|
--path <path-template> -p <path-template> | Output path template (required). Supports metadata placeholders like {.fn}. |
--columns <expr1> [<expr2> ...] -c ... | Expressions to export as columns (required). |
--select <expr> | Boolean expression used to filter rows before writing. |
--domain <domain> -d <domain> | Domain used to resolve expressions (default: reciprocal). |
Behavior
- Expressions in
--columnsare evaluated per row. --selectkeeps only rows where the expression istrue.- One file is generated per page (after path template expansion).
- Header includes EstraPy version, project name, original filename, analysis date, and metadata.
Example
save columns --path "processed/{.fn}_chi.dat" --columns k chi --domain reciprocal
save columns --path "processed/{.fn}_windowed.dat" --columns k "chi*k^2" --select "k > 3 and k < 14"
Save table
Exports one table file per resolved path. Inside each table, first column is the selected axis expression, and additional columns are one data series per page.
save table --path <path-template> --axis <axis-expr> --column <data-expr> [options]
Options
| Option | Description |
|---|---|
--path <path-template> -p <path-template> | Output path template (required). Pages resolving to the same path are grouped in one table. |
--axis <expr> -a <expr> | Axis expression (required). Must be identical across grouped pages. |
--column <expr> -c <expr> | Data expression (required). One output column per page. |
--select <expr> | Boolean expression used to filter rows before writing. |
--domain <domain> -d <domain> | Domain used to resolve expressions. If omitted, inferred from axis expression. |
Behavior
- Pages with the same resolved
--pathare merged into one output table. - Column names are page names.
- If axis arrays differ between grouped pages, EstraPy raises an error (
Axis data mismatch ...). - Header includes axis/column expressions and list of original files.
Example
save table --path "tables/chi_vs_k.dat" --axis k --column chi --domain reciprocal
save table --path "tables/chi_k2.dat" --axis k --column k^2*chi --select 2<=k<=14
Path Templates
--path supports metadata placeholders (template replacement), for example:
{.fn}→ original file name{sample}→ metadata field namedsample{.f}_{.g}→ generated page name and group ID
Example:
save columns --path "out/{sample}_{.fn}_norm.dat" --columns E mu
Notes and Best Practices
- Use explicit expressions in
--columns,--axis, and--columnto make exported files self-documenting. - For
save table, align data first (cut,interpolate, orrebin) to avoid axis mismatch errors. - Use
--selectto export only the physically relevant interval (e.g. EXAFS region). - Exports are plain text with fixed-width numeric formatting.