dense#
This module uses tinygp to construct dense representations of kernels for testing/benchmarking performance and accuracy.
Danger
They are not meant for use on large datasets!
Kernels defined here:
SHOKernel: A stochastic harmonic oscillator (SHO) kernel
IntegratedSHOKernel: A tinygp/JAX implementation of the integrated SHO kernel from Luhn et al. 2026.
Classes#
The base class for all kernel implementations |
|
The base class for all kernel implementations |
Functions#
|
Recursively extract all tinygp leaf kernels from a sum or product of tinygp kernels |
|
Unpack the input coordinates X1 and X2 into time, instrument ID, and exposure time. |
Module Contents#
- smolgp.kernels.dense.extract_leaf_kernels(kernel, all=False)[source]#
Recursively extract all tinygp leaf kernels from a sum or product of tinygp kernels
- smolgp.kernels.dense.unpack_coordinates(X1, X2)[source]#
Unpack the input coordinates X1 and X2 into time, instrument ID, and exposure time.
- X1 and X2 can either be
t1 and t2 for single instrument, no exposure times
- or
(t1, instid1) and (t2, instid2) for multiple instruments, no exposure times
- or
(t1, instid1, delta1) and (t2, instid2, delta2) for exposure times, also requires instrument IDs
- Returns
(t1, instid1, delta1), (t2, instid2, delta2) where instid and delta are arrays of zeros if not provided
- class smolgp.kernels.dense.SHOKernel(S=None, w=None, Q=None, rho=None, tau=None, sig=None)[source]#
Bases:
tinygp.kernels.KernelThe base class for all kernel implementations
This subclass provides default implementations to add and multiply kernels. Subclasses should accept parameters in their
__init__and then overrideKernel.evaluate()with custom behavior.- S: jax.Array | float#
- w: jax.Array | float#
- Q: jax.Array | float#
- rho: jax.Array | float#
- tau: jax.Array | float#
- sig: jax.Array | float#
- evaluate(X1, X2)[source]#
Calculate the kernel for given pair of times X1 and X2.
- X1 and X2 can either be
t1 and t2 for single instrument, no exposure times
- or
(t1, instid1) and (t2, instid2) for multiple instruments, no exposure times
- or
- (t1, delta1, instid1) and (t2, delta2, instid2) for exposure times,
also requires instrument IDs even if a single instrument
- class smolgp.kernels.dense.IntegratedSHOKernel(S=None, w=None, Q=None, rho=None, tau=None, sig=None)[source]#
Bases:
tinygp.kernels.KernelThe base class for all kernel implementations
This subclass provides default implementations to add and multiply kernels. Subclasses should accept parameters in their
__init__and then overrideKernel.evaluate()with custom behavior.- S: jax.Array | float#
- w: jax.Array | float#
- Q: jax.Array | float#
- rho: jax.Array | float#
- tau: jax.Array | float#
- sig: jax.Array | float#
- eta: jax.Array | float#
- a: jax.Array | float#
- Delta(X1, X2)[source]#
Time difference (absolute value) between pairs of observations X1, X2.
Delta = | t1 - t2 |
- integrated_separate(Delta, delta1, delta2)[source]#
The double integral for two non-overlapping observations. Depends on the time-lag (Delta) and the two exposure times (delta1, delta2)
Eq. 17 in L26
- integrated_overlap(delta)[source]#
The double integral for two perfectly overlapping observations (i.e. zero time-lag). As such, this only depends on the exposure time (delta)
Eq. 13 in L26
- integrated_single(Delta, delta)[source]#
The single integral for when one observation has zero exposure time (e.g. latent curve)
Eq. 10 in L26
- full_single_integral(Delta, delta)[source]#
This helper function handles the logic for the single integral case.
For pairs of observation coordinates separated by Delta, such that one is the 0-exposure test point (i.e., the latent curve) and the other has exposure time delta, this function handles the logic to break up the integral and call self.integrated_single() for the sub-exposures where appropriate