Parameterises values based on linear combination of orthogonal polynomials
over a given set of values for independent variable x [1] .
This function expects to recieve data already normalised and log-transformed.
params (list | str) – Pre-computed parameters for the orthogonal polynomials (a list of tuples).
Optionally specified, otherwise defaults the parameterisation as in
O’Neill (2016). [1] If a string is supplied, "O'Neill(2016)" or
similar will give the original defaults, while "full" will use all
of the REE (including Eu) as a basis for the orthogonal polynomials.
degree (int) – Degree of orthogonal polynomial fit.
algorithm (str) – Algorithm to use for fitting the orthogonal polynomials.
anomalies (list) – List of relative anomalies to append to the dataframe.
fit_tetrads (bool) – Whether to fit tetrad functions in addition to orthogonal polynomial functions.
This will force the use of the optimization algorithm.
sigmas (float | numpy.ndarray) – Single value or 1D array of observed value uncertainties.
add_uncertainties (bool) – Whether to append estimated parameter uncertainties to the dataframe.
add_X2 (bool) – Whether to append the chi-squared values (χ2) to the dataframe.
Finds the parameters
\((\beta_0), (\gamma_0, \gamma_1), (\delta_0, \delta_1, \delta_2)\) etc.
for constructing orthogonal polynomial functions f(x) over a fixed set of values
of independent variable x.
Used for obtaining lambda values for dimensional reduction of REE data [2].
Parameters:
xs (numpy.ndarray) – Indexes over which to generate the orthogonal polynomials.
degree (int) – Maximum polynomial degree. E.g. 2 will generate constant, linear, and quadratic
polynomial components.
rounding (int) – Precision for the orthogonal polynomial coefficents.
Returns:
List of tuples corresponding to coefficients for each of the polynomial
components. I.e the first tuple will be empty, the second will contain a single
coefficient etc.
Note that the y-array is passed here only to infer the shape which should be
assumed by the uncertainty array.
Through propagation of uncertainties, the uncertainty on the natural logarithm of
the normalised REE values are equivalent to \(\sigma_{REE} / REE\) where the
uncertainty in the reference composition is assumed to be zero. Thus, standard
deviations of 1% in REE will result in \(\sigma=0.01\) for the log-transformed
REE. If no sigmas are provided, 1% uncertainty will be assumed and an array of
0.01 will be returned.
Generation and evalutation of orthogonal polynomial and tetrad functions from sets of
parameters (the sequence of polymomial roots and tetrad centres and widths).
x0 (numpy.ndarray) – Starting guess for the function weights.
func_components (list ( numpy.ndarray )) – List of arrays representing static/evaluated function components.
redsiduals_function (callable) – Callable funciton to compute residuals which accepts ordered arguments for
weights, target values and function components.
sigmas (float | numpy.ndarray) – Single value or 1D array of normalised observed value uncertainties
(\(\sigma_{REE} / REE\)).
Returns:
B, s, χ2 – Arrays for the optimized parameter values (B; (n, d)), parameter
uncertaintes (s, 1σ; (n, d)) and chi-chi_squared (χ2; (n, 1)).
Parameterises values based on linear combination of orthogonal polynomials
over a given set of values for independent variable x. [5]
Parameters:
df (pandas.DataFrame | :class:`pandas.Series) – Target data to fit. For geochemical data, this is typically normalised
so we can fit a smooth function.
radii (list, numpy.ndarray) – Radii at which to evaluate the orthogonal polynomial.
params (list, None) – Orthogonal polynomial coefficients (see
orthogonal_polynomial_constants()).
fit_tetrads (bool) – Whether to also fit the patterns for tetrads.
tetrad_params (list) – List of parameter sets for tetrad functions.
fit_method (str) – Which fit method to use: "optimization" or "linear".
sigmas (float | numpy.ndarray) – Single value or 1D array of observed value uncertainties.
add_uncertainties (bool) – Whether to append estimated parameter uncertainties to the dataframe/series.
add_X2 (bool) – Whether to append the chi-squared values (χ2) to the dataframe/series.
Returns:
Optimial results for weights of orthogonal polymomial regression (lambdas).
Functions for the visualisation of reconstructed and deconstructed parameterised REE
profiles based on parameterisations using ‘lambdas’ (and tetrad-equivalent weights
‘taus’).
drop0 (bool) – Whether to remove zeroes from the outputs such that individual tetrad
functions are shown only within their respective bounds (and not across the
entire REE, where their effective values are zero).
Plot the reconstructed REE profiles of a 2D dataset of coefficients ($lambda$s,
and optionally $tau$s).
Parameters:
coefficients (numpy.ndarray) – 2D array of $lambda$ orthogonal polynomial coefficients, and optionally
including $tau$ tetrad function coefficients in the last four columns
(where tetrads=True).