{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "418aa304",
            "cell_type": "markdown",
            "source": "<div class='alert alert-warning'>\n\nSciPy's interactive examples with Jupyterlite are experimental and may not always work as expected. Execution of cells containing imports may result in large downloads (up to 60MB of content for the first import from SciPy). Load times when importing from SciPy may take roughly 10-20 seconds. If you notice any problems, feel free to open an [issue](https://github.com/scipy/scipy/issues/new/choose).\n\n</div>",
            "metadata": {}
        },
        {
            "id": "7c9d8784",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "import numpy as np\nfrom scipy import signal",
            "outputs": []
        },
        {
            "id": "16bd2eab",
            "cell_type": "markdown",
            "source": "Confirm NOLA condition for rectangular window of 75% (3/4) overlap:\n",
            "metadata": {}
        },
        {
            "id": "88101452",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "signal.check_NOLA(signal.windows.boxcar(100), 100, 75)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "True"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "ebfe9a9c",
            "cell_type": "markdown",
            "source": "NOLA is also true for 25% (1/4) overlap:\n",
            "metadata": {}
        },
        {
            "id": "7d00fbab",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "signal.check_NOLA(signal.windows.boxcar(100), 100, 25)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "True"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "cd0966f7",
            "cell_type": "markdown",
            "source": "\"Symmetrical\" Hann window (for filter design) is also NOLA:\n",
            "metadata": {}
        },
        {
            "id": "4c107711",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "signal.check_NOLA(signal.windows.hann(120, sym=True), 120, 60)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "True"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "a9128670",
            "cell_type": "markdown",
            "source": "As long as there is overlap, it takes quite a pathological window to fail\nNOLA:\n",
            "metadata": {}
        },
        {
            "id": "441b9e0e",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "w = np.ones(64, dtype=\"float\")\nw[::2] = 0\nsignal.check_NOLA(w, 64, 32)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "False"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "be47f85c",
            "cell_type": "markdown",
            "source": "If there is not enough overlap, a window with zeros at the ends will not\nwork:\n",
            "metadata": {}
        },
        {
            "id": "115ea1f0",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "signal.check_NOLA(signal.windows.hann(64), 64, 0)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "False"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "746cc5af",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "signal.check_NOLA(signal.windows.hann(64), 64, 1)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "False"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "3dba9e66",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "signal.check_NOLA(signal.windows.hann(64), 64, 2)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "True"
                    },
                    "execution_count": null
                }
            ]
        }
    ]
}