pflm.fpca.utils.rotate_polyfit2d#

rotate_polyfit2d(x_grid: ndarray, y: ndarray, w: ndarray, new_grid: ndarray, bandwidth: float, kernel_type: KernelType = KernelType.GAUSSIAN) ndarray[source][source]#

Evaluate a 2D local polynomial fit on a rotated/new grid.

Performs weighted local polynomial regression on the input grid and evaluates the smoothed surface at new_grid. The underlying computation is delegated to optimized low-level routines.

Parameters:
x_gridnp.ndarray of shape (2, n)

Original 2D coordinates where responses are observed: stacked as [x; y] with two rows and n columns.

ynp.ndarray of shape (n,)

Observed responses aligned with columns of x_grid.

wnp.ndarray of shape (n,)

Non-negative sample weights.

new_gridnp.ndarray of shape (2, m)

New 2D coordinates (stacked rows) at which to evaluate the fitted surface.

bandwidthfloat

Positive bandwidth parameter for the kernel.

kernel_typeKernelType, default=KernelType.GAUSSIAN

Kernel used by the local polynomial smoother.

Returns:
y_newnp.ndarray of shape (m,)

Fitted values evaluated at new_grid.

Raises:
TypeError

If bandwidth is not a real number.

ValueError

If bandwidth is non-positive or NaN; if kernel_type is not a valid KernelType; or if input array dimensions are inconsistent.

Notes

  • Inputs are validated and coerced to a consistent dtype before calling the low-level routine.

  • This function does not select bandwidth; it assumes bandwidth is given.