Skip to content

bartlett50

Generates a Bartlett window of the given size with 50% overlap.

Parameters:

Name Type Description Default
segment_size int

Size of the window to be created.

required
dtype dtype

The desired datatype of the window

float32

Returns:

Type Description
Tuple[NDArray[Any], int]

A bartlett window with 50% overlap

Source code in src/libsegmenter/windows/bartlett.py
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
def bartlett50(
    segment_size: int, dtype: DTypeLike = np.float32
) -> Tuple[NDArray[Any], int]:
    """
    Generates a Bartlett window of the given size with 50% overlap.

    Args:
        segment_size (int): Size of the window to be created.
        dtype (np.dtype): The desired datatype of the window

    Returns:
        A bartlett window with 50% overlap

    """
    assert segment_size % 2 == 0, f"segment_size must be even, got {segment_size}"

    return _bartlett(segment_size, dtype=dtype), segment_size // 2