pyrolite.comp.pyrocomp (Pandas Interface)
- class pyrolite.comp.pyrocomp(obj)[source]
- renormalise(components: list = [], scale=100.0)[source]
Renormalises compositional data to ensure closure.
- Parameters
- Returns
Renormalized dataframe.
- Return type
Notes
This won’t modify the dataframe in place, you’ll need to assign it to something. If you specify components, those components will be summed to 100%, and others remain unchanged.
- ALR(components=[], ind=-1, null_col=False, label_mode='simple')[source]
Additive Log Ratio transformation.
- Parameters
- Returns
ALR-transformed array, of shape
(N, D-1)
.- Return type
- inverse_ALR(ind=None, null_col=False)[source]
Inverse Additive Log Ratio transformation.
- Parameters
- Returns
Inverse-ALR transformed array, of shape
(N, D)
.- Return type
- CLR(label_mode='simple')[source]
Centred Log Ratio transformation.
- Parameters
label_mode (
str
) – Labelling mode for the output dataframe (numeric
,simple
,LaTeX
). If you plan to use the outputs for automated visualisation and want to know which components contribute, usesimple
orLaTeX
.- Returns
CLR-transformed array, of shape
(N, D)
.- Return type
- inverse_CLR()[source]
Inverse Centred Log Ratio transformation.
- Returns
Inverse-CLR transformed array, of shape
(N, D)
.- Return type
- ILR(label_mode='simple')[source]
Isometric Log Ratio transformation.
- Parameters
label_mode (
str
) – Labelling mode for the output dataframe (numeric
,simple
,LaTeX
). If you plan to use the outputs for automated visualisation and want to know which components contribute, usesimple
orLaTeX
.- Returns
ILR-transformed array, of shape
(N, D-1)
.- Return type
- inverse_ILR(X=None)[source]
Inverse Isometric Log Ratio transformation.
- Parameters
X (
numpy.ndarray
,None
) – Optional specification for an array from which to derive the orthonormal basis, with shape(N, D)
.- Returns
Inverse-ILR transformed array, of shape
(N, D)
.- Return type
- boxcox(lmbda=None, lmbda_search_space=(-1, 5), search_steps=100, return_lmbda=False)[source]
Box-Cox transformation.
- Parameters
lmbda (
numpy.number
,None
) – Lambda value used to forward-transform values. If none, it will be calculated using the meanlmbda_search_space (
tuple
) – Range tuple (min, max).search_steps (
int
) – Steps for lambda search range.- Returns
Box-Cox transformed array.
- Return type
- inverse_boxcox(lmbda=None)[source]
Inverse Box-Cox transformation.
- Parameters
lmbda (
float
) – Lambda value used to forward-transform values.- Returns
Inverse Box-Cox transformed array.
- Return type
- sphere()[source]
Spherical coordinate transformation for compositional data.
- Returns
θ – Array of angles in radians (\((0, \pi / 2]\))
- Return type
- inverse_sphere(variables=None)[source]
Inverse spherical coordinate transformation to revert back to compositional data in the simplex.