{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "27de357d",
            "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": "20d41a74",
            "cell_type": "markdown",
            "source": "The Sentinel-1A/B Instrument Processing Facility uses generalized Hamming\nwindows in the processing of spaceborne Synthetic Aperture Radar (SAR)\ndata [3]. The facility uses various values for the $\\alpha$\nparameter based on operating mode of the SAR instrument. Some common\n$\\alpha$ values include 0.75, 0.7 and 0.52 [4]. As an example, we\nplot these different windows.\n",
            "metadata": {}
        },
        {
            "id": "5ef5a6e2",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "import numpy as np\nfrom scipy.signal.windows import general_hamming\nfrom scipy.fft import fft, fftshift\nimport matplotlib.pyplot as plt",
            "outputs": []
        },
        {
            "id": "1d6be0ae",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "fig1, spatial_plot = plt.subplots()\nspatial_plot.set_title(\"Generalized Hamming Windows\")\nspatial_plot.set_ylabel(\"Amplitude\")\nspatial_plot.set_xlabel(\"Sample\")",
            "outputs": []
        },
        {
            "id": "64f4f86e",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "fig2, freq_plot = plt.subplots()\nfreq_plot.set_title(\"Frequency Responses\")\nfreq_plot.set_ylabel(\"Normalized magnitude [dB]\")\nfreq_plot.set_xlabel(\"Normalized frequency [cycles per sample]\")",
            "outputs": []
        },
        {
            "id": "b05bd9b4",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "for alpha in [0.75, 0.7, 0.52]:\n    window = general_hamming(41, alpha)\n    spatial_plot.plot(window, label=\"{:.2f}\".format(alpha))\n    A = fft(window, 2048) / (len(window)/2.0)\n    freq = np.linspace(-0.5, 0.5, len(A))\n    response = 20 * np.log10(np.abs(fftshift(A / abs(A).max())))\n    freq_plot.plot(freq, response, label=\"{:.2f}\".format(alpha))\nfreq_plot.legend(loc=\"upper right\")\nspatial_plot.legend(loc=\"upper right\")",
            "outputs": []
        }
    ]
}