{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "c230dca5",
            "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": "7cc71d02",
            "cell_type": "markdown",
            "source": "Low-pass from 0 to f:\n",
            "metadata": {}
        },
        {
            "id": "ab47ff3d",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "from scipy import signal\nnumtaps = 3\nf = 0.1\nsignal.firwin(numtaps, f)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([ 0.06799017,  0.86401967,  0.06799017])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "a29a6a6d",
            "cell_type": "markdown",
            "source": "Use a specific window function:\n",
            "metadata": {}
        },
        {
            "id": "e0a64369",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "signal.firwin(numtaps, f, window='nuttall')",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([  3.56607041e-04,   9.99286786e-01,   3.56607041e-04])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "c8eb43e1",
            "cell_type": "markdown",
            "source": "High-pass ('stop' from 0 to f):\n",
            "metadata": {}
        },
        {
            "id": "9e10b106",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "signal.firwin(numtaps, f, pass_zero=False)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([-0.00859313,  0.98281375, -0.00859313])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "b5e14c7a",
            "cell_type": "markdown",
            "source": "Band-pass:\n",
            "metadata": {}
        },
        {
            "id": "b915ef36",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "f1, f2 = 0.1, 0.2\nsignal.firwin(numtaps, [f1, f2], pass_zero=False)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([ 0.06301614,  0.88770441,  0.06301614])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "80aedbf1",
            "cell_type": "markdown",
            "source": "Band-stop:\n",
            "metadata": {}
        },
        {
            "id": "c32e21df",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "signal.firwin(numtaps, [f1, f2])",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([-0.00801395,  1.0160279 , -0.00801395])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "fead538e",
            "cell_type": "markdown",
            "source": "Multi-band (passbands are [0, f1], [f2, f3] and [f4, 1]):\n",
            "metadata": {}
        },
        {
            "id": "c223a1b6",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "f3, f4 = 0.3, 0.4\nsignal.firwin(numtaps, [f1, f2, f3, f4])",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([-0.01376344,  1.02752689, -0.01376344])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "b979e6bd",
            "cell_type": "markdown",
            "source": "Multi-band (passbands are [f1, f2] and [f3,f4]):\n",
            "metadata": {}
        },
        {
            "id": "4a517865",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "signal.firwin(numtaps, [f1, f2, f3, f4], pass_zero=False)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([ 0.04890915,  0.91284326,  0.04890915])"
                    },
                    "execution_count": null
                }
            ]
        }
    ]
}