{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "e849a466",
            "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": "10e472a4",
            "cell_type": "markdown",
            "source": "We can register a new fft backend:\n",
            "metadata": {}
        },
        {
            "id": "fb9d4047",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "from scipy.fft import fft, register_backend, set_global_backend\nclass NoopBackend:  # Define an invalid Backend\n    __ua_domain__ = \"numpy.scipy.fft\"\n    def __ua_function__(self, func, args, kwargs):\n         return NotImplemented\nset_global_backend(NoopBackend())  # Set the invalid backend as global\nregister_backend(\"scipy\")  # Register a new backend",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "# The registered backend is called because\n# the global backend returns `NotImplemented`"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "3cc9e41e",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "fft([1])",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([1.+0.j])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "475a50eb",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "set_global_backend(\"scipy\")  # Restore global backend to default",
            "outputs": []
        }
    ]
}