hamming_window#

ivy.hamming_window(window_length, /, *, periodic=True, alpha=0.54, beta=0.46, dtype=None, out=None)[source]#

Compute the Hamming window with window length window_length.

Parameters:
  • window_length (int) – an int defining the length of the window.

  • periodic (bool) – If True, returns a window to be used as periodic function. (default: True) If False, return a symmetric window.

  • alpha (float) – The coefficient alpha in the hamming window equation (default: 0.54)

  • beta (float) – The coefficient beta in the hamming window equation (default: 0.46)

  • dtype (Optional[Union[Dtype, NativeDtype]]) – data type of the returned array. (default: None)

  • out (Optional[Array]) – optional output array, for writing the result to. (default: None)

Return type:

Array

Returns:

ret – The array containing the window.

Examples

>>> ivy.hamming_window(5)
ivy.array([0.0800, 0.3979, 0.9121, 0.9121, 0.3979])
>>> ivy.hamming_window(5, periodic=False)
ivy.array([0.0800, 0.5400, 1.0000, 0.5400, 0.0800])
>>> ivy.hamming_window(5, periodic=False, alpha=0.2, beta=2)
ivy.array([-1.8000,  0.2000,  2.2000,  0.2000, -1.8000])
Container.hamming_window(self, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, periodic=True, alpha=0.54, beta=0.46, dtype=None, out=None)#

ivy.Container instance method variant of ivy.hamming_window. This method simply wraps the function, and so the docstring for ivy.hamming_window also applies to this method with minimal changes.

Parameters:
  • self (Container) – input container including window lenghts.

  • periodic (bool) – If True, returns a window to be used as periodic function. (default: True) If False, return a symmetric window.

  • alpha (float) – The coefficient alpha in the hamming window equation (default: 0.54)

  • beta (float) – The coefficient beta in the hamming window equation (default: 0.46)

  • dtype (Optional[Union[Array, NativeArray]]) – data type of the returned arrays. (default: None)

  • out (Optional[Container]) – optional output container, for writing the result to. (default: None)

Return type:

Container

Returns:

ret – The container that includes the Hamming windows.

Examples

>>> x = ivy.Container(a=3, b=5))
>>> x.hamming_window(periodic=True, alpha=0.2, beta=2)
{
    a: ivy.array([-1.8000,  1.2000,  1.2000]),
    b: ivy.array([-1.8000, -0.4180,  1.8180,  1.8180, -0.4180])
}