{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Spectrogram of Parallel Chirps with Short Gaussian Analysis Window\n\nThis example visualizes the spectrogram of two \"parallel\" chirps, using a\nGaussian window function that has a short length, relative to the length of a\nsignal. The two chirps can be made out, but interference can also be seen along\nthe frequency axis, since frequency resolution is compromised.\n\nFigure 3.15 from the tutorial.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "from tftb.generators import fmlin\nfrom tftb.processing.cohen import Spectrogram\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nsig = fmlin(128, 0, 0.4)[0] + fmlin(128, 0.1, 0.5)[0]\nwindow = np.exp(np.log(0.005) * np.linspace(-1, 1, 23) ** 2)\nspec = Spectrogram(sig, fwindow=window, n_fbins=128)\nspec.run()\nspec.plot(show_tf=True, cmap=plt.cm.gray)"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.7.9"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}