{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Gabor Representation of a Chirp with Oversampling\n\n\nFigure 3.13 from the tutorial.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "from tftb.generators import fmlin\nfrom tftb.processing.linear import gabor\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nN1 = 256\nNg = 33\nQ = 4\nsig = fmlin(N1)[0]\nwindow = np.exp(np.log(0.005) * np.linspace(-1, 1, Ng) ** 2)\nwindow = window / np.linalg.norm(window)\ntfr, dgr, h = gabor(sig, 32, Q, window)\ntime = np.arange(256)\nfreq = np.linspace(0, 0.5, 128)\nplt.imshow(np.flipud(tfr)[8:, :], aspect='auto', extent=[0, 32, 0, 0.5],\n           interpolation='none')\nplt.xlabel('Time')\nplt.ylabel('Normalized frequency')\nplt.title('Squared modulus of the Gabor coefficients')\nplt.show()"
      ]
    }
  ],
  "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.3"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}