spline#
- swordfish.function.spline()#
Resample X based on the specified resampleRule, closed and origin. Perform cubic spline interpolation on Y based on the resampled X.
If outputX is unspecified, return a vector of Y after the interpolation.
If outputX=true, return a tuple where the first element is the vector of resampled X and the second element is a vector of Y after the interpolation.
- Parameters:
X (Constant) – A strictly increasing vector of temporal type.
Y (Constant) – A numeric vector of the same length as X.
resampleRule (Constant) – A string. See the parameter rule of function resample for the optional values.
closed (Constant, optional) –
A string indicating which boundary of the interval is closed, by default DFLT.
The default value is ‘left’ for all values of rule except for ‘M’, ‘A’, ‘Q’, ‘BM’, ‘BA’, ‘BQ’, and ‘W’ which all have a default of ‘right’.
The default is ‘right’ if origin is ‘end’ or ‘end_day’.
origin (Constant, optional) –
A string or a scalar of the same data type as X, indicating the timestamp where the intervals start, by default DFLT. It can be ‘epoch’, start’, ‘start_day’, ‘end’, ‘end_day’ or a user-defined time object.
’epoch’: origin is 1970-01-01
’start’: origin is the first value of the timeseries
’start_day’: origin is 00:00 of the first day of the timeseries
’end’: origin is the last value of the timeseries
’end_day’: origin is 24:00 of the last day of the timeseries
outputX (Constant, optional) – A Boolean value indicating whether to output the resampled X, by default DFLT.