Output: add CLI help text

This commit is contained in:
wyj committed 2026-09-03 19:24:32 -04:00
1 parent dd8cf29dac
commit 1a54e59eb4
1 file changed
+65
+65
View File
@@ -300,6 +300,67 @@ static int parse_args(int argc, char **argv, Settings *s,
return 0; return 0;
} }
static void print_help(const char *program) {
#ifdef ENABLE_PNG
const char *default_output_path = "output/imgs/minkowski_sky.png";
#else
const char *default_output_path = "output/imgs/minkowski_sky.ppm";
#endif
printf("Usage: %s [options]\n\n", program);
fputs("Input/output:\n"
" --catalog PATH Single CSV catalog (default: assets/sky_grid_5deg.csv)\n"
" --all-sky-catalog DIR Lazy-loaded all-sky catalog directory (default: disabled)\n"
" --output PATH Tonemapped image path (default: ", stdout);
printf("%s)\n", default_output_path);
fputs(" --write-catalog PATH Write the generated test catalog and exit (default: disabled)\n"
#ifdef ENABLE_HDR_OUTPUT
" --hdr-output Also write a single-frame linear HDR FITS file (default: disabled)\n"
#endif
"\nImage and camera:\n"
" --width N Image width in pixels (default: 1280)\n"
" --height N Image height in pixels (default: 720)\n"
" --fov-deg D Horizontal field of view in degrees (default: 30)\n"
" --look-ra-deg D ICRS look direction right ascension in degrees (default: 90)\n"
" --look-dec-deg D ICRS look direction declination in degrees (default: -90)\n"
" --exposure E Linear exposure multiplier (default: 1e-3)\n"
" --observer-radius R Observer radius in Schwarzschild units (default: 30)\n"
" --observer-inward-speed V Inward observer speed as a fraction of c (default: 0)\n"
"\nPSF and catalog splatting:\n"
" --psf-fwhm-pixels N Moffat PSF FWHM in pixels (default: 2.7)\n"
" --psf-moffat-beta N Moffat PSF beta, greater than 1 (default: 4.5)\n"
" --max-magnification M Preview magnification cap (default: unlimited)\n"
" --max-cache-psf-flux F Cache flux limit before direct fallback (default: 1)\n"
" --psf-relative-tail R Maximum omitted relative PSF tail fraction (default: 1e-8)\n"
" --psf-min-y Y Skip events below this linear HDR luminance (default: 0, disabled)\n"
" --psf-direct Disable the PSF lookup cache (default: disabled)\n"
" --catalog-load-workers N All-sky catalog loader workers (default: 4)\n"
"\nAdaptive lens mesh:\n"
" --coarse-cell-pixels N Initial mesh cell size in pixels (default: 16)\n"
" --refine-max-level N Maximum refinement level (default: 0)\n"
" --refine-angle-abs-deg D Absolute angular interpolation error limit (default: 0.001)\n"
" --refine-angle-rel R Relative angular interpolation error limit (default: 0.1)\n"
" --refine-jacobian-min J Fold-refinement Jacobian threshold (default: 1e-3)\n"
" --refine-min-edge-pixels P Stop refinement below this edge length (default: 0.5)\n"
" --refine-min-area-pixels2 A Stop refinement below this triangle area (default: 0.25)\n"
" --draw-mesh Draw the final lens mesh overlay (default: disabled)\n"
"\nMovie and observer track:\n"
" --observer-track PATH Observer worldline/tetrad CSV for movie rendering (default: disabled)\n"
" --frames-dir DIR Write a movie image sequence to this directory (default: disabled)\n"
" --frames-prefix NAME Movie frame filename prefix (default: frame)\n"
" --start-time T Movie start coordinate time (default: 0)\n"
" --duration T Movie duration (default: 2)\n"
" --fps N Movie frame rate (default: 30)\n"
" --slab-duration T Metric time-slab duration (default: 64)\n"
" --proper-acceleration A Minkowski accelerated-track proper acceleration (default: 1.52)\n"
" --write-minkowski-accel-track PATH\n"
" Write a generated Minkowski acceleration track and exit (default: disabled)\n"
"\nOther:\n"
" --verbose Print low-frequency rendering progress (default: disabled)\n"
" --help Print this help and exit\n",
stdout);
}
typedef struct { typedef struct {
int verbose; int verbose;
size_t frame_id; size_t frame_id;
@@ -694,6 +755,10 @@ static int write_minkowski_accel_track(const Settings *s) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
Settings settings; Settings settings;
const char *write_path; const char *write_path;
if (argc == 2 && !strcmp(argv[1], "--help")) {
print_help(argv[0]);
return 0;
}
if (parse_args(argc, argv, &settings, &write_path)) { if (parse_args(argc, argv, &settings, &write_path)) {
fprintf(stderr, fprintf(stderr,
"Usage: %s [--catalog PATH | --all-sky-catalog DIR] [--output PATH] [--width N] [--height " "Usage: %s [--catalog PATH | --all-sky-catalog DIR] [--output PATH] [--width N] [--height "