hann_window#

ivy.hann_window(size, *, periodic=True, dtype=None, out=None)[source]#

Generate a Hann window. The Hanning window is a taper formed by using a weighted cosine.

Parameters:
  • size (int) – the size of the returned window.

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

  • dtype (Optional[Union[Dtype, NativeDtype]], default: None) – The data type to produce. Must be a floating point type.

  • 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.hann_window(4, periodic = True)
ivy.array([0. , 0.5, 1. , 0.5])
>>> ivy.hann_window(7, periodic = False)
ivy.array([0.  , 0.25, 0.75, 1.  , 0.75, 0.25, 0.  ])
Container.hann_window(self, periodic=True, dtype=None, *, out=None)[source]#

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

Parameters:
  • self (Container) – input container with window sizes.

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

  • dtype (Optional[Union[Dtype, NativeDtype, Container]], default: None) – The data type to produce. Must be a floating point type.

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

Return type:

Container

Returns:

ret – The container containing the Hann windows.

Examples

With one ivy.Container input:

>>> x = ivy.Container(a=3, b=5)
>>> ivy.hann_window(x)
{
    a: ivy.array([0.0000, 0.7500, 0.7500])
    b: ivy.array([0.0000, 0.3455, 0.9045, 0.9045, 0.3455])
}