{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "ee94a393",
            "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": "7c83f716",
            "cell_type": "markdown",
            "source": "Generate a 5x5 low-pass filter with cutoff frequency 0.1:\n",
            "metadata": {}
        },
        {
            "id": "9f7ba5a1",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "import numpy as np\nfrom scipy.signal import get_window\nfrom scipy.signal import firwin_2d\nhsize = (5, 5)\nwindow = ((\"kaiser\", 5.0), (\"kaiser\", 5.0))\nfc = 0.1\nfilter_2d = firwin_2d(hsize, window, fc=fc)\nfilter_2d",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([[0.00025366, 0.00401662, 0.00738617, 0.00401662, 0.00025366],\n       [0.00401662, 0.06360159, 0.11695714, 0.06360159, 0.00401662],\n       [0.00738617, 0.11695714, 0.21507283, 0.11695714, 0.00738617],\n       [0.00401662, 0.06360159, 0.11695714, 0.06360159, 0.00401662],\n       [0.00025366, 0.00401662, 0.00738617, 0.00401662, 0.00025366]])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "38f1de53",
            "cell_type": "markdown",
            "source": "Generate a circularly symmetric 5x5 low-pass filter with Hamming window:\n",
            "metadata": {}
        },
        {
            "id": "40c42108",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "filter_2d = firwin_2d((5, 5), 'hamming', fc=fc, circular=True)\nfilter_2d",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([[-0.00020354, -0.00020354, -0.00020354, -0.00020354, -0.00020354],\n       [-0.00020354,  0.01506844,  0.09907658,  0.01506844, -0.00020354],\n       [-0.00020354,  0.09907658, -0.00020354,  0.09907658, -0.00020354],\n       [-0.00020354,  0.01506844,  0.09907658,  0.01506844, -0.00020354],\n       [-0.00020354, -0.00020354, -0.00020354, -0.00020354, -0.00020354]])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "b47f80aa",
            "cell_type": "markdown",
            "source": "Generate Plots comparing the product of two 1d filters with a circular\nsymmetric filter:\n",
            "metadata": {}
        },
        {
            "id": "e82c48c9",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "import matplotlib.pyplot as plt\nhsize, fc = (50, 50), 0.05\nwindow = ((\"kaiser\", 5.0), (\"kaiser\", 5.0))\nfilter0_2d = firwin_2d(hsize, window, fc=fc)\nfilter1_2d = firwin_2d((50, 50), 'hamming', fc=fc, circular=True)\n\nfg, (ax0, ax1) = plt.subplots(1, 2, tight_layout=True, figsize=(6.5, 3.5))\nax0.set_title(\"Product of 2 Windows\")\nim0 = ax0.imshow(filter0_2d, cmap='viridis', origin='lower', aspect='equal')\nfg.colorbar(im0, ax=ax0, shrink=0.7)\nax1.set_title(\"Circular Window\")\nim1 = ax1.imshow(filter1_2d, cmap='plasma', origin='lower', aspect='equal')\nfg.colorbar(im1, ax=ax1, shrink=0.7)\nplt.show()",
            "outputs": []
        }
    ]
}