Skip to content

Python API — pipeline tools

Exact reference of flags, arguments and exit codes for the Python tools of the Belico pipeline. It complements the CLI reference (the public Phase D CLI) — here live the tools/ scripts that orchestrate acquisition, compute, production and validation.

Canonical source

This page migrates from docs/shared/API_REFERENCE.md. For the usage context of each tool see docs/shared/TOOLS.md.


Boot & Setup

boot_status.py

python tools/boot_status.py

EXIT CODES:
  0  OK
  1  Critical error (Engram down, missing deps)

init_project.py

python tools/init_project.py [--name NAME] [--domain DOMAIN] [--quartile Q]

EXIT CODES:
  0  OK
  1  Input error

setup_csl.ps1

.\tools\setup_csl.ps1 [-Verify]

OPTIONS:
  -Verify   Verify only, no download

Data Acquisition

peer_downloader.py

python tools/peer_downloader.py --rsn RSN [RSN ...] --out DIR [OPTIONS]

OPTIONS:
  --rsn RSN [...]   Record Sequence Numbers (required)
  --out DIR         Destination folder (required)
  --email EMAIL     Override PEER_EMAIL from .env
  --password PASS   Override PEER_PASSWORD from .env

EXAMPLE:
  python tools/peer_downloader.py --rsn 766 1158 4517 --out db/excitation/records/

fetch_domain_data.py

python tools/fetch_domain_data.py --domain DOMAIN [--source S] [--verify] [--list-sources]

EXIT CODES:
  0  OK
  1  Adapter failed / missing credentials

select_ground_motions.py

python tools/select_ground_motions.py [--mw MIN MAX] [--rrup MIN MAX] [--vs30 MIN MAX] [--n N] [--out CSV]

EXAMPLE:
  python tools/select_ground_motions.py --mw 6.5 7.5 --rrup 0 50 --n 11

Compute

research_director.py

python tools/research_director.py [--config PATH] [--profile NAME] [--dry-run]

EXIT CODES:
  0  Full campaign, convergence OK
  1  Divergence / solver error

compute_statistics.py

python tools/compute_statistics.py --quartile q1|q2|q3|q4 [--alpha 0.05] [--bootstrap-n 10000] [--input DIR]

EXIT CODES:
  0  Gate 2 pass (p < alpha)
  1  Not significant (increase N)

generate_compute_manifest.py

python tools/generate_compute_manifest.py [--domain D] [--design-sources F1,F2,...] [--emulation] [--guardian]

EXIT CODES:
  0  all_design_sources_exist: true
  1  Missing sources → IMPLEMENT blocked

Paper Production

plot_figures.py

python tools/plot_figures.py --domain DOMAIN [--quartile Q] [--only FIG_ID] [--format pdf,png]

EXAMPLE:
  python tools/plot_figures.py --domain structural --quartile q2

style_calibration.py

python tools/style_calibration.py --venue VENUE --paper-id ID [--year Y] [--n 5] [--save-md]

EXIT CODES:
  0  OK
  1  API error / 0 papers found

generate_bibtex.py

python tools/generate_bibtex.py [--domain D] [--categories C1,C2] [--out articles/references.bib]

Validation

validate_submission.py

python tools/validate_submission.py DRAFT [--diagnose] [--suggest-trace] [--skip-ai] [--json] [--force]

EXIT CODES:
  0  All gates pass
  1  At least one ERROR
  2  HARD BLOCK (not compilable)

verify_citations.py

python tools/verify_citations.py DRAFT [--bib PATH] [--out JSON]

EXIT CODES:
  0  All verified
  1  At least one suspect/invalid
  2  At least one retracted

Citation & Discovery

find_top_sources.py

python tools/find_top_sources.py --query "TEXT" [--quartile Q] [--n 20] [--min-year Y] [--exclude-retracted] [--out JSON]

EXIT CODES:
  0  ≥1 result
  1  0 results

check_novelty.py

python tools/check_novelty.py --keywords "K1, K2, K3" [--save] [--deep] [--max-results 50]

EXIT CODES:
  0  ORIGINAL
  1  INCREMENTAL
  2  DUPLICATE

literature_rag.py

python tools/literature_rag.py {search|embed|query|export} [OPTIONS]

EXAMPLES:
  python tools/literature_rag.py search --query "SHM ML" --n 100
  python tools/literature_rag.py query --q "how to detect cracks"
  python tools/literature_rag.py export --bibtex out.bib

Compilation

compile_paper.sh / .ps1

bash tools/compile_paper.sh DRAFT [--template ieee|elsevier|conference|plain] [--institution INST] [--force]

EXIT CODES:
  0  PDF generated
  1  validate_submission failed
  2  Pandoc/LaTeX failed

For the navigable tool catalog see Tools catalog. The exhaustive list of scripts (Patent Engine, Archive, Audit, shell scripts) lives in docs/shared/API_REFERENCE.md.