Tapers

Collection of classes representing tapers (also called tapering functions or window functions). Such tapers must have two methods.

  • .taper(x, window) corresponding to the tapering function \(t(x, W)\),

  • .ft_taper(k, window) corresponding to the Fourier transform \(\mathcal{F}[t(\cdot, W)](k)\) of the tapering function.

These tapers satisfy some conditions listed in [HGBLachiezeR22] (Sections 3.1, 4.3).

Example

class MyTaper:
    @staticmethod
    def taper(x, window):
        """A taper is a function supported on a window."""
        taper = ...  # The taper
        return taper

    @staticmethod
    def ft_taper(k, window):
        """The Fourier transform of the taper."""
        ft = ...  # Fourier transform of the taper
        return ft
class structure_factor.tapers.BartlettTaper[source]

Bases: object

Class representing the Bartlett tapering function.

static taper(x, window)[source]

Evaluate the Bartlett taper \(t(x, W)\) at x given the rectangular window \(W\).

\[t(x, W) = \frac{1}{\sqrt{|W|}} 1_{x \in W}.\]
Parameters
  • x (numpy.ndarray) – Array of size \(n \times d\), where \(d\) is the ambient dimension and \(n\) the number of points where the tapering function is evaluated.

  • window (BoxWindow) – \(d\)-dimensional rectangular window \(W\).

Returns

evaluation of the taper \(t(x, W)\).

Return type

numpy.ndarray

static ft_taper(k, window)[source]

Evaluate the Fourier transform \(F[t(\cdot, W)](k)\) of the taper \(t\) (taper()).

Parameters
  • k (numpy.ndarray) – Array of size \(n \times d\), where \(d\) is the ambient dimension and \(n\) the number of points where the Fourier transform is evaluated.

  • window (BoxWindow) – \(d\)-dimensional rectangular window \(W\).

Returns

Evaluation of the Fourier transform at k.

Return type

numpy.ndarray

class structure_factor.tapers.SineTaper(p)[source]

Bases: object

Class representing the sine tapering function.

__init__(p)[source]
taper(x, window)[source]

Evalute the sine taper \(t(x, W)\) indexed by p at x given the rectangular window \(W\).

Parameters
  • x (numpy.ndarray) – Array of size \(n \times d\), where \(d\) is the ambient dimension and \(n\) the number of points where the tapering function is evaluated.

  • window (BoxWindow) – \(d\)-dimensional rectangular window \(W\).

Returns

evaluation of the taper \(t(x, W)\).

Return type

numpy.ndarray

ft_taper(k, window)[source]

Evaluate the Fourier transform \(F[t(\cdot, W)](k)\) of the taper \(t\) (taper()).

Parameters
  • k (numpy.ndarray) – Array of size \(n \times d\), where \(d\) is the ambient dimension and \(n\) the number of points where the Fourier transform is evaluated.

  • window (BoxWindow) – \(d\)-dimensional rectangular window \(W\).

Returns

Evaluation of the Fourier transform at k.

Return type

numpy.ndarray

structure_factor.tapers.multi_sinetaper_grid(d, p_component_max=2)[source]

Given a class of taper taper_p of parameter p of \(\mathbb{R}^d\), return the list of taper taper_p(p) with \(p \in \{1, ..., P\}^d\).

Parameters
  • d (int) – Space dimension.

  • taper_p (Class) – Class of taper pf parameter p.

  • p_component_max (int) – Maximum component of the parameters \(p\) of the family of tapers. Intuitively the number of taper used is \(P=\mathrm{p\_component\_max}^d\). Used only when tapers=None. Defaults to 2.

Returns

List of taper taper_p(p) with \(p \in \{1, ..., p\_component\_max\}^d\).

Return type

list