.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_micro_doppler.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_micro_doppler.py: Micro-Doppler time-frequency analysis ===================================== Resolve a sinusoidally varying radial velocity with a radar-aware STFT. The same result carries frequency, time, and velocity coordinates. .. GENERATED FROM PYTHON SOURCE LINES 8-50 .. image-sg:: /auto_examples/images/sphx_glr_plot_micro_doppler_001.png :alt: Micro-Doppler spectrogram :srcset: /auto_examples/images/sphx_glr_plot_micro_doppler_001.png :class: sphx-glr-single-img .. code-block:: Python from __future__ import annotations import numpy as np from matplotlib import pyplot as plt from pyradar.base import Radar from pyradar.rsp import micro_doppler_spectrogram radar = Radar.awr1843_rampcnn() sampleRate = 1.0 / radar.slowTimeInterval time = np.arange(512) / sampleRate meanVelocity = 0.5 microVelocity = 1.2 motionFrequency = 25.0 # Doppler phase is the time integral of 2 v(t) / wavelength. phaseCycles = (2.0 / radar.wavelength) * ( meanVelocity * time + microVelocity * np.sin(2.0 * np.pi * motionFrequency * time) / (2.0 * np.pi * motionFrequency) ) slowTimeSignal = np.exp(2j * np.pi * phaseCycles) result = micro_doppler_spectrogram( slowTimeSignal, radar=radar, segmentLength=96, overlap=88, fftSize=256, ) figure, axis = plt.subplots(figsize=(7, 3.8), constrained_layout=True) powerDb = 10.0 * np.log10(np.maximum(result.power, np.finfo(float).tiny)) image = axis.pcolormesh(result.time, result.velocity, powerDb, shading="auto") axis.set( xlabel="Time (s)", ylabel="Radial velocity (m/s)", title="Micro-Doppler spectrogram", ) figure.colorbar(image, ax=axis, label="Power (dB)") plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.191 seconds) .. _sphx_glr_download_auto_examples_plot_micro_doppler.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_micro_doppler.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_micro_doppler.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_micro_doppler.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_