interp_param | R Documentation |
Utility functions to interpolate the lineat of log spaced weights for a vector of values. This can be used to create interpolations for x versus y type data, but it is more useful when the property to be weighted is non-trivial, e.g. you have spectra on a grid of metallicities and you want to interpolate between values. interp_quick
is faster, but can only be used for single value lookups, has less flesibility, and returns less information.
interp_param(x, params, log = FALSE, method = "linear")
interp_quick(x, params, log = FALSE)
x |
Numeric vector; the value/s to use for the interpolation. For |
params |
Numeric vector; the values to be interpolated. |
log |
Logical scalar; should the interpolation be done in linear space (log=FALSE, the default), or log space (log=TRUE). |
method |
One of “constant", “linear", “nearest", “spline", or “cubic"; default is “linear". This is passed to |
This routine is used to calculate appropriate weights for a number of interpolations within ProSpect
, where outputs are often generated for fixed grids of parameters (e.g. metallicity, AGN fraction and radiation field).
x param_lo param_hi ID_lo weight_lo ID_hi weight_hi flag A data.frame with the same number of rows as the length of x, with columns:
x |
The value/s uses for the interpolation (might be different to the input x if this went beyond the limits of params) |
param_lo |
The nearest value of params lower than x |
param_hi |
The nearest value of params higher than x |
ID_lo |
The location ID of the nearest value of params lower than x |
ID_hi |
The location ID of the nearest value of params higher than x |
ID_mode |
The ID with the most weight between ID_lo and ID_hi |
wt_lo |
The interpolation weight to be applied to the nearest value of params lower than x |
wt_hi |
The interpolation weight to be applied to the nearest value of params higher than x |
flag |
Interpolation flag: 0 means the input x is at an exact value of params, in which case ID_lo=ID_hi, weight_lo=1 and weight_hi=0; 1 means x is less than the minimum of params, so forced to this value; 2 means x is between two values in params, so interpolation behaves in a standard sense; 3 means x is more than the maximum of params, so forced to this value |
In the output, flag=2 is the "normal" flag in the sense the interpolation has not gone beyond the limits of params and is not trivial (as exact value of params).
Aaron Robotham
Dale_interp
interp_param(c(0.1,3.3,5.8,8,11.2),1:10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.