API Usage
This page shows practical Python workflows built on lst_tools. Use
Workflow for the phase layout and
API Reference for full signatures and module-level details.
Use the API when Python control flow is part of the workflow.
- modify
lst.cfgprogrammatically before setup - loop over multiple cases or parameter values
- integrate
lst-toolsinto a larger preprocessing or post-processing script - keep setup and processing inside one Python driver
Use the CLI when one-off commands are enough and shell usage is simpler.
Initialization and Meanflow Preparation
Most Python workflows start by loading the config, changing a few values, and writing the updated file back to disk.
Keep Configuration open while editing values.
Meanflow conversion is a lower-level API step than setup or processing.
convert_meanflow expects Grid and Flow objects plus a loaded config:
Use this path when base-flow data is already available in Python. For the exact data requirements and helper objects, use the Convert and Grid & Flow reference pages.
Setup Runs
The setup functions accept a loaded config and write the same artifacts as the CLI commands.
Use these functions when a Python script is preparing runs for several cases or updating the config between steps.
Use one Python driver to edit config values and prepare several runs:
This kind of loop is usually the main reason to switch from CLI to API.
Postprocessing and Cleanup
The processing functions are useful when results need to be filtered, batched, or chained into another analysis step.
Pass selected kc_* directories through kc_dirs when tracking processing
should target only part of a run set.
Quick preview visualization is currently exposed through the CLI wrappers.
Use lst-tools visualize parsing or lst-tools visualize tracking when PNG
output is needed.