fit_sectorial: Fit sectorial simulation to a bi or three dimensional model

View source: R/fit_sectorial.R

fit_sectorialR Documentation

Fit sectorial simulation to a bi or three dimensional model

Description

Fits sectorial APSF(s) with a combination of Singular Value Decomposition and polynomials.

Usage

fit_sectorial(psfl, norm = TRUE, tpred = NULL, pord = 10, ncmp = 3)

Arguments

psfl

A list of psf objects.

norm

Logical: should the psf be normalized to integrate to unity? Forced to TRUE when tpred is specified.

tpred

Optional third predictor. See Details.

pord

Polynomial order.

ncmp

Number of Singular Value Decomposition components to use.

Details

The procedure for fitting APSF as depending on radius, azimuth and possibly a third variable follow the method outlined by Mandel (1981). The APSF is first decomposed with Singular Value Deconmposition and the first ncmp components of the u and v matrices are fitted with polynomials of order pord to the original independent variables radius and azimuth when no third predictor is provided.

If a third predictor is provided (e.g., view angle), the APSFs are combined by row (long table format for radius and the third predictor) and the each u component is arranged in matrix format as a function of radius and the third predictor and again decomposed by SDV, with its u and v components fitted by polynomials as a function of radius and the third predictor. The third predictor can be specified by tpred as one of: "pressure", "view", "altitude" or "fov".

The maximum value of ncmp is 361 due to the fixed angular resolution of the sectorial geometry. The total number of parameters used to fit the surface(s) depends on ncmp and pord. Without a third predictor it will be: ncmp + 2 * ncmp * pord.

If a third predictor is requested, the maximum number of parameters will be: ncmp + ncmp^2 + (2 * ncmp + 1) * pord. The final number will be lower depending if the polynomial order is larger than the number of independent levels in tpred.

Value

A list with model parameters.

References

Mandel, J. 1981. Fitting Curves and Surfaces with Monotonic and Non-Monotonic Four Parameter Equations. Journal of research of the National Bureau of Standards Vol. 86, 1, 1-25.

See Also

predict_sectorial, predict_annular

Examples

# Fitting a single sectorial APSF:
data(ssim)
fit1 <- fit_sectorial(ssim[3])
prd1 <- predict_sectorial(r = ssim[[1]]$bin_brks, fit = fit1, type = "cumpsf")
sqrt(mean((prd1 - cum_psf(ssim[[3]]))^2, na.rm = T)) # RMSE

# Fitting a single sectorial APSFs with view angle dependence:
fit2 <- fit_sectorial(ssim, tpred = "view")
prd2 <- predict_sectorial(r = ssim[[1]]$bin_brks, tpred = 60 * pi / 180, 
  fit = fit2, type = "cumpsf")
sqrt(mean((prd2 - cum_psf(ssim[[3]]))^2, na.rm = T)) # RMSE


AlexCast/apsfs documentation built on Feb. 1, 2024, 9:48 p.m.