essos.coil_perturbation

Classes

GaussianSampler

Generate a periodic gaussian process on the interval [0, 1] on a given list of quadrature points.

PerturbationSample

Functions

matrix_sqrt_via_spectral(A)

Compute matrix square root of SPD matrix A via spectral decomposition.

perturb_curves_systematic(curves, sampler[, key])

Apply a systematic perturbation to all the coils.

perturb_curves_statistic(curves, sampler[, key])

Apply a statistic perturbation to all the coils.

Module Contents

essos.coil_perturbation.matrix_sqrt_via_spectral(A)

Compute matrix square root of SPD matrix A via spectral decomposition.

class essos.coil_perturbation.GaussianSampler(points: jaxtyping.Array, sigma: jaxtyping.Float, length_scale: jaxtyping.Float, n_derivs: int = 0)

Generate a periodic gaussian process on the interval [0, 1] on a given list of quadrature points. The process has standard deviation sigma a correlation length scale length_scale. Large values of length_scale correspond to smooth processes, small values result in highly oscillatory functions. Also has the ability to sample the derivatives of the function.

We consider the kernel

\[\kappa(d) = \sigma^2 \exp(-d^2/l^2)\]

and then consider a Gaussian process with covariance

\[Cov(X(s), X(t)) = \sum_{i=-\infty}^\infty \sigma^2 \exp(-(s-t+i)^2/l^2)\]

the sum is used to make the kernel periodic and in practice the infinite sum is truncated.

Parameters:
  • points – the quadrature points along which the perturbation should be computed.

  • sigma – standard deviation of the underlying gaussian process (measure for the magnitude of the perturbation).

  • length_scale – length scale of the underlying gaussian process (measure for the smoothness of the perturbation).

  • n_derivs – number of derivatives to calculate, right now maximum is up to 2

points: jaxtyping.Array
sigma: jaxtyping.Float
length_scale: jaxtyping.Float
n_derivs: int
kernel_periodicity(x, y)
d_kernel_periodicity_dx(x, y)
d_kernel_periodicity_dxdx(x, y)
d_kernel_periodicity_dxdxdx(x, y)
d_kernel_periodicity_dxdxdxdx(x, y)
compute_covariance_matrix()
compute_covariance_matrix_and_first_derivatives()
compute_covariance_matrix_and_second_derivatives()
get_covariance_matrix()
draw_sample(key=0)
class essos.coil_perturbation.PerturbationSample(sampler, key=0, sample=None)
sampler
key = 0
resample()
get_sample(deriv)

Get the perturbation (if deriv=0) or its deriv-th derivative.

essos.coil_perturbation.perturb_curves_systematic(curves: essos.coils.Curves, sampler: GaussianSampler, key=None)

Apply a systematic perturbation to all the coils. This means taht an independent perturbation is applied to the each unique coil Then, the required symmetries are applied to the perturbed unique set of coils

Parameters:
  • curves – curves to be perturbed.

  • sampler – the gaussian sampler used to get the perturbations

  • key – the seed which will be splited to geenerate random

  • pertubations (but reproducible)

Returns:

The curves given as an input are modified and thus no return is done

essos.coil_perturbation.perturb_curves_statistic(curves: essos.coils.Curves, sampler: GaussianSampler, key=None)

Apply a statistic perturbation to all the coils. This means taht an independent perturbation is applied every coil including repeated coils

Parameters:
  • curves – curves to be perturbed.

  • sampler – the gaussian sampler used to get the perturbations

  • key – the seed which will be splited to geenerate random

  • pertubations (but reproducible)

Returns:

The curves given as an input are modified and thus no return is done