Skip to content

CLI reference

The spectro command, version 0.8.1. This page is generated from the argument parser at build time, so it is exactly what spectro --help says; Using it from the command line explains the workflow. Every command accepts --json for machine-readable output where it makes sense.

spectro [-h] [--version]
               {list,categories,describe,source,presets,run,pipeline,preset,info} ...

Global options

Option Kind Required Default Description
--version flag - - show program's version number and exit

Commands

Command What it does
spectro list list algorithms in the catalogue
spectro categories list non-empty categories
spectro describe show full details of one algorithm
spectro source print the source code of one algorithm (for auditing the wrapper)
spectro presets list bundled pipeline presets
spectro run run a single algorithm
spectro pipeline run a preset pipeline
spectro preset inspect and validate presets (recipes)
spectro info show catalogue summary

spectro list

List algorithms in the catalogue.

spectro list [-h] [--category CATEGORY] [--json]
Option Kind Required Default Description
--category CATEGORY value - - restrict to one category
--json flag - - emit JSON

spectro categories

List non-empty categories.

spectro categories [-h] [--json]
Option Kind Required Default Description
--json flag - - emit JSON

spectro describe

Show full details of one algorithm.

spectro describe [-h] [--json] name
Option Kind Required Default Description
NAME positional yes - algorithm name
--json flag - - emit JSON

spectro source

Print the source code of one algorithm (for auditing the wrapper).

spectro source [-h] [--json] [--url-only] name
Option Kind Required Default Description
NAME positional yes - algorithm name
--json flag - - emit JSON
--url-only flag - - only print the GitHub permalink, not the source code

spectro presets

List bundled pipeline presets.

spectro presets [-h] [--json]
Option Kind Required Default Description
--json flag - - emit JSON

spectro run

Run a single algorithm.

spectro run [-h] [--input INPUT] [--param PARAM] [--output OUTPUT] [--json] algorithm
Option Kind Required Default Description
ALGORITHM positional yes - algorithm name
--input, -i INPUT value - - spectrum file to load into the context
--param, -p PARAM value, repeatable - - parameter as key=value
--output, -o OUTPUT value - - write the resulting spectrum here
--json flag - - emit JSON

ALGORITHM is any algorithm of the catalogue (spectro list prints them, the catalogue documents them). Parameters are passed with --param key=value (repeatable); values are auto-typed: 3 is an int, 3.0 a float, true / false booleans, none / null None, anything else a string. spectro describe ALGORITHM lists the parameter names and their defaults. The --input spectrum is read into ctx.spectrum before the run, so an algorithm that needs a 2-D frame or several spectra runs from Python or as a step of a recipe instead.

spectro pipeline

Run a preset pipeline.

spectro pipeline [-h] [--input INPUT] [--output OUTPUT] [--keep-going] [--profile PROFILE]
                        [--set NAME=VALUE] [--json]
                        preset
Option Kind Required Default Description
PRESET positional yes - preset name or path to a YAML file
--input, -i INPUT value - - spectrum file to load into the context
--output, -o OUTPUT value - - write the resulting spectrum here
--keep-going flag - - run every step even after a failure
--profile PROFILE value - - YAML mapping of variable values (instrument / observer profile)
--set NAME=VALUE value, repeatable - - set one preset variable (repeatable, overrides --profile)
--json flag - - emit JSON

PRESET is a recipe name (spectro presets lists them) or the path to a YAML file. A recipe that declares variables takes their values from --profile (a YAML mapping) and --set NAME=VALUE; --set wins. See Recipes.

spectro preset

Inspect and validate presets (recipes).

spectro preset [-h] {validate,show} ...
Sub-command What it does
spectro preset validate check preset files or names without running them
spectro preset show print a preset's variables and steps

spectro preset validate

Check preset files or names without running them.

spectro preset validate [-h] [--profile PROFILE] [--set NAME=VALUE] [--json]
                               targets [targets ...]
Option Kind Required Default Description
TARGETS [...] positional yes - preset names or YAML paths
--profile PROFILE value - - YAML profile to type-check variable values
--set NAME=VALUE value, repeatable - - variable value
--json flag - - emit a JSON summary too

spectro preset show

Print a preset's variables and steps.

spectro preset show [-h] [--json] name
Option Kind Required Default Description
NAME positional yes - preset name or YAML path
--json flag - - emit JSON

spectro info

Show catalogue summary.

spectro info [-h] [--json]
Option Kind Required Default Description
--json flag - - emit JSON

Exit codes

Code Meaning
0 success
1 the algorithm or the pipeline reported a failure (run, pipeline, preset validate)
2 a kernel error was raised before or while running (unknown algorithm or preset, invalid parameter, missing file); the message is printed on stderr

The same catalogue, every door

spectro run and spectro pipeline are thin shells over the registry: the Python API and the MCP tools expose the same algorithms with the same parameters and defaults.