spectrochempy.kern¶
- kern(K, p, q)[source]¶
Compute kernel of Fredholm equation of the 1st kind.
This function computes a kernel matrix and returns it as NDDataset. Pre-defined kernels can be chosen among: {‘langmuir’, ‘ca’, ‘reactant-first-order’, ‘product-first-order’, diffusion} A custom kernel fucntion - a 2-variable lambda function
ker(p, q)
or a function returning a ndarray can be passed.p
andq
contain the values of an external experimental variable and an internal physico-chemical parameter, respectively.- Parameters
K (str or callable) – Kernel type.
p (Coord or ndadarray) – External variable.
q (Coord or ndadarray) – Internal variable.
- Returns
NDDataset – The kernel.
See also
IRIS
Integral inversion solver for spectroscopic data.
Examples
# the three examples below are equivalents: >>> scp.kern(‘langmuir’, np.linspace(0, 1, 100), np.logspace(-10, 1, 10)) NDDataset: [float64] unitless (shape: (y:100, x:10))
>>> F = lambda p, q : np.exp(-q) * p[:, None] / (1 + np.exp(-q) * p[:, None]) >>> scp.kern(F, np.linspace(0, 1, 100), np.logspace(-10, 1, 10)) NDDataset: [float64] unitless (shape: (y:100, x:10))
>>> def F(p,q): ... return np.exp(-q) * p[:, None] / (1 + np.exp(-q) * p[:, None]) >>> >>> scp.kern(F, np.linspace(0, 1, 100), np.logspace(-10, 1, 10)) NDDataset: [float64] unitless (shape: (y:100, x:10))
# p and q can also be passed as coordinates: >>> p = scp.Coord(np.linspace(0, 1, 100), name=”pressure”, title=”p”, units=”torr”) >>> q = scp.Coord(np.logspace(-10, 1, 10), name=”reduced adsorption energy”, … title=”$Delta_{ads}G^{0}/RT$”, units=””) >>> scp.kern(‘langmuir’, p, q) NDDataset: [float64] unitless (shape: (y:100, x:10))