Skip to content

ricker_wavelet

Bases: discrete_wavelet

Ricker wavelet implementation, also known as the "Mexican hat wavelet."

Source code in tinybig/koala/signal_processing/wavelet.py
class ricker_wavelet(discrete_wavelet):
    """
    Ricker wavelet implementation, also known as the "Mexican hat wavelet."
    """
    def __init__(self, sigma: float = 1.0, name: str = 'ricker_wavelet', *args, **kwargs):
        """
        Initialize the Ricker wavelet.

        Parameters
        ----------
        sigma : float, optional
            Standard deviation of the Gaussian envelope. Must be >= 0. Default is 1.0.
        name : str, optional
            Name of the wavelet. Default is 'ricker_wavelet'.
        *args, **kwargs
            Additional parameters.
        """
        super().__init__(name=name, *args, **kwargs)
        if sigma < 0.0:
            raise ValueError('sigma must be >= 0.')
        self.sigma = sigma

    def psi(self, tau: torch.Tensor):
        """
        Define the Ricker wavelet function.

        Parameters
        ----------
        tau : torch.Tensor
            Transformed input values.

        Returns
        -------
        torch.Tensor
            Wavelet values for the input.
        """
        term1 = 2.0*(1.0-(tau/self.sigma)**2)/(math.sqrt(3*self.sigma)*(torch.pi**0.25))
        term2 = torch.exp(-tau**2/(2*self.sigma**2))
        return term1*term2

__init__(sigma=1.0, name='ricker_wavelet', *args, **kwargs)

Initialize the Ricker wavelet.

Parameters:

Name Type Description Default
sigma float

Standard deviation of the Gaussian envelope. Must be >= 0. Default is 1.0.

1.0
name str

Name of the wavelet. Default is 'ricker_wavelet'.

'ricker_wavelet'
*args

Additional parameters.

()
**kwargs

Additional parameters.

()
Source code in tinybig/koala/signal_processing/wavelet.py
def __init__(self, sigma: float = 1.0, name: str = 'ricker_wavelet', *args, **kwargs):
    """
    Initialize the Ricker wavelet.

    Parameters
    ----------
    sigma : float, optional
        Standard deviation of the Gaussian envelope. Must be >= 0. Default is 1.0.
    name : str, optional
        Name of the wavelet. Default is 'ricker_wavelet'.
    *args, **kwargs
        Additional parameters.
    """
    super().__init__(name=name, *args, **kwargs)
    if sigma < 0.0:
        raise ValueError('sigma must be >= 0.')
    self.sigma = sigma

psi(tau)

Define the Ricker wavelet function.

Parameters:

Name Type Description Default
tau Tensor

Transformed input values.

required

Returns:

Type Description
Tensor

Wavelet values for the input.

Source code in tinybig/koala/signal_processing/wavelet.py
def psi(self, tau: torch.Tensor):
    """
    Define the Ricker wavelet function.

    Parameters
    ----------
    tau : torch.Tensor
        Transformed input values.

    Returns
    -------
    torch.Tensor
        Wavelet values for the input.
    """
    term1 = 2.0*(1.0-(tau/self.sigma)**2)/(math.sqrt(3*self.sigma)*(torch.pi**0.25))
    term2 = torch.exp(-tau**2/(2*self.sigma**2))
    return term1*term2