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, default: True) – If True, returns a window to be used as periodic function. If False, return a symmetric window.

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

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

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

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

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)[source]#

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 lengths.

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

  • alpha (Union[float, Container], default: 0.54) – The coefficient alpha in the hamming window equation

  • beta (Union[float, Container], default: 0.46) – The coefficient beta in the hamming window equation

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

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

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])
}