polaris.tasks.ocean.horiz_press_grad.metrics.power_law_fit

polaris.tasks.ocean.horiz_press_grad.metrics.power_law_fit(x: ndarray, y: ndarray, fit_mask: ndarray | None = None) → tuple[ndarray, float, float][source]

Fit y = 10**b * x**m in log10 space.

Parameters:
  • x (numpy.ndarray) – The abscissa (resolution or tilt). Only positive, finite entries take part in the fit.

  • y (numpy.ndarray) – The ordinate (an error metric). Only positive, finite entries take part in the fit.

  • fit_mask (numpy.ndarray, optional) – An additional boolean mask restricting which points are fit.

Returns:

  • fit (numpy.ndarray) – The fitted curve evaluated at every entry of x.

  • slope (float) – The fitted exponent m.

  • intercept (float) – The fitted log10 intercept b.