4. Kernel operations¶
Beside addition, multiplication and power, the function where()
can be
used to make a kernel that switches between two kernels based on a local
condition.
- lsqfitgp.where(condfun, kernel1, kernel2, dim=None)[source]¶
Make a kernel(x, y) that yields:
kernel1(x, y) where condfun(x) and condfun(y) are True
kernel2(x, y) where condfun(x) and condfun(y) are False
zero where condfun(x) is different from condfun(y)
- Parameters:
- condfuncallable
Function that is applied on an array of points and must return a boolean array with the same shape.
- kernel1Kernel
Kernel used where condfun yields True.
- kernel2Kernel
Kernel used where condfun yields False.
- dimstr or None
If specified, when the input arrays are structured,
condfun
is applied only to the fielddim
. If the field has a shape, the array passed tocondfun
still hasdim
as explicit field.
- Returns:
- Kernel
If both kernel1 and kernel2 are IsotropicKernel, the class is IsotropicKernel.