{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Hough-Wigner Transform of Two Simultaneous Chirps\n\nCompute the Hough transform of the Wigner-Ville distribution of a signal\ncomposed of two chirps. Two peaks corresponding to the two chirps can be seen.\n\nFigure 5.6 from the tutorial.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "from tftb.generators import fmlin, sigmerge\nfrom tftb.processing.cohen import WignerVilleDistribution\nfrom tftb.processing.postprocessing import hough_transform\nimport numpy as np\nfrom mpl_toolkits.mplot3d import Axes3D\nimport matplotlib.pyplot as plt\n\nN = 64\nsig = sigmerge(fmlin(N, 0, 0.4)[0], fmlin(N, 0.3, 0.5)[0], 1)\ntfr, _, _ = WignerVilleDistribution(sig).run()\n\nht, rho, theta = hough_transform(tfr, N, N)\ntheta, rho = np.meshgrid(theta, rho)\nfig = plt.figure()\nax = fig.gca(projection='3d')\nax.plot_wireframe(theta, rho, ht)\nax.set_xlabel('Theta')\nax.set_ylabel('Rho')\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.9"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}