pgkyl fit

Usage: pgkyl fit [OPTIONS]

  Fit a model to data and return the fitted curve.

  Fits the model named (or expressed) by ``fit_type`` to each component of ``data``
  independently and returns the fitted values evaluated on the data's (cell-centered)
  grid. Axes collapsed to a single cell (e.g. after ``integrate`` or ``select``) are
  dropped, so 1D and 2D fits are supported.

Options:
  -f, --fit_type TEXT           the model to fit -- a key of ``numerics.FIT_FUNCTIONS``
                                ('linear', 'quadratic', 'plane', 'quadratic2d',
                                'exp_plateau', 'gaussian', 'power', 'sinusoid',
                                'tanh_transition', 'exp2'), or a custom RPN expression
                                string (e.g. ``'x a * b +'``) whose free tokens (not the
                                spatial variables 'x'/'y', operators, or numbers) become
                                fit parameters.  [required]
  -g, --guess TEXT              initial guess for the fit parameters -- a comma-
                                separated string (e.g. ``'1,0,2'``) or a sequence of
                                floats. None derives a data-driven guess per component
                                via ``numerics.auto_guess`` (for the first window, if
                                ``window=True``, or each window for exp_plateau).
  -w, --window [BOOLEAN]        fit only the best-scoring leading window of the data (1D
                                only) instead of the full domain -- see
                                ``numerics.fit_best_window``.  [default: False]
  -m, --min_n INTEGER           minimum window length when ``window=True``; ``None``
                                defaults to one tenth of the number of samples. Ignored
                                otherwise.
  -p, --print_coeffs [BOOLEAN]  print the model equation and coefficient descriptions,
                                followed by named coefficients with estimated 1-sigma
                                uncertainties, R^2, residual sum of squares (RSS), root
                                mean squared error (RMSE), residual standard error,
                                sample count, degrees of freedom, and coordinate ranges
                                for each zero-based component (12 significant digits).
                                Statistics use only the fitted points, including when
                                ``window=True``. R^2 is undefined for constant data;
                                residual standard error requires positive residual
                                degrees of freedom. Custom RPN models show their
                                expression and free parameter names. Full precision
                                remains in ``ctx['fit_params']``, ``ctx['fit_std']``,
                                and ``ctx['fit_R2']``.  [default: False]
  -i, --inplace [BOOLEAN]       mutate and return ``data`` instead of a new dataset.
                                [default: False]
  -t, --tag TEXT                optional tag for the returned dataset.
  -l, --label TEXT              optional label for the returned dataset.
  --help                        Show this message and exit.

Python API