Skip to main content

A suite of tools performing noise analysis

Project description

PySNR

Build Status Documentation Status License: MIT

PySNR is a Python library which provides a suite of tools for performing various types of noise analysis on signals. PySNR aims to provide five main functionalities:

  • SNR (Signal to Noise Ratio)
  • THD (Total Harmonic Distortion)
  • SINAD (Signal to Noise and Distortion Ratio)
  • TOI (Third Order Intercept)
  • SFDR (Spurious Free Dynamic Range)

The following sections elaborate on each of these utilities further.

Signal to Noise Ratio (SNR)

This calculates the signal-to-noise ratio of an input signal. Signal-to-Noise ratio is defined as the ratio between the power of the desired signal to the power of the background noise.

If the noise magnitude is provided along with the signal, the SNR is calculated using the following formula: $$20 \log_{10}\left({\frac{\sqrt{\sum signal^2}}{\sqrt{\sum noise^2}}}\right)$$

If the noise magnitude is not provided, a modified periodogram is computed using a Kaiser window with $\beta = 38$ and the SNR is computed using the power of fundamental frequency and the power of the signal after removing the top 6 harmonics. The formula used in this case is: $$10 \log_{10}\left({\frac{\sqrt{\sum signal^2}}{\sqrt{\sum noise^2}}}\right)$$

The SNR value can also be computed by providing the periodograms of power spectral density $(V^{2}/Hz)$ or power spectrum $(V^{2})$. In case of power spectrum periodograms,the resolution bandwidth needs to be provided as well. Utilities provide the enbw() function which computes the estimated noise bandwidth for assessing the resolution bandwidth.

Total Harmonic Distortion (THD)

This calculates the total harmonic distortion of a signal. Total harmonic distortion is defined as the ratio of the power of the harmonics to the power of the fundamental frequency.

A modified periodogram is computed using a Kaiser window with $\beta = 38$ and this information is then used to determine the fundamental frequency and its harmonics. The formula used for computing the THD is: $$\frac{\sqrt{V^2_{H_1} + V^2_{H_2} + V^2_{H_3} + ...}}{V_{H_0}}$$

The THD value can also be computed by providing the periodograms of power spectral density $(V^{2}/Hz)$ or power spectrum $(V^{2})$. In case of power spectrum periodograms, the resolution bandwidth needs to be provided as well. Utilities provide the enbw() function which computes the estimated noise bandwidth for assessing the resolution bandwidth.

Signal to Noise and Distortion Ratio (SINAD)

This calculates the signal-to-noise-and-distortion ratio of a signal. SINAD is defined as the ratio between the power of the signal's fundamental frequency to the power of the background noise and harmonics.

A modified periodogram is computed using a Kaiser window with $\beta = 38$ and this information is then used to determine the fundamental frequency and its harmonics. The formula used for computing the SINAD is: $$\frac{P_{fundamental}}{P_{noise} + P_{harmonics}}$$

The SINAD value can also be computed by providing the periodograms of power spectral density $(V^{2}/Hz)$ or power spectrum $(V^{2})$. In case of power spectrum periodograms, the resolution bandwidth needs to be provided as well. Utilities provide the enbw() function which computes the estimated noise bandwidth for assessing the resolution bandwidth.

Third Order Intercept (TOI)

This calculates the third order intercept point for a signal. There are six third-order intermodulation points from the top two dominant frequencies $F_1$ and $F_2$ (fundamental signals) — $3F_1$, $3F_2$, $2F_1 + F_2$, $2F_2 + F_1$, $2F_1 - F_2$ and $2F_2 - F_1$. Amongst these, the hardest to handle are $2F_1 - F_2$ and $2F_2 - F_1$ because of how c lose they are to the fundamental signals. TOI helps us compute the point at which the power of the third order products intercepts the power of the fundamental signals. In real world devices, this does not happen because the output power is limited; hence, the TOI is a theoretical value. TOI helps evaluate the linearity of the signal source. The higher the TOI, the better the linearity with lower levels of intermodulation distortion.

A modified periodogram is computed using a Kaiser window with $\beta = 38$ and this information is then used to identify the two dominant frequencies $F_1$ and $F_2$ which is considered the fundamental signal. The formula used for computing the TOI is: $$\overline{P_{fundamental}} + \frac{\overline{P_{fundamental}} - \overline{P_{intermodulation}}}{2}$$

The TOI value can also be computed by providing the periodograms of power spectral density $(V^{2}/Hz)$ or power spectrum $(V^{2})$. In case of power spectrum periodograms, the resolution bandwidth needs to be provided as well. Utilities provide the enbw() function which computes the estimated noise bandwidth for assessing the resolution bandwidth.

Spurious Free Dynamic Range (SFDR)

This calculates the spurious free dynamic range of a signal. SFDR is defined as the strength ratio of the fundamental signal to the strongest spurious signal.

A modified periodogram is computed using a Kaiser window with $\beta = 38$ and this information is then used to determine the fundamental frequency and its harmonics. The formula used for computing the SFDR is: $$10 \log_{10}\left({\frac{P_{fundamental}}{P_{spurious}}}\right)$$

The SFDR value can also be computed by providing the periodograms of power spectral density $(V^{2}/Hz)$ or power spectrum $(V^{2})$. In case of power spectrum periodograms, the resolution bandwidth needs to be provided as well. Utilities provide the enbw() function which computes the estimated noise bandwidth for assessing the resolution bandwidth.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysnr-0.0.1.tar.gz (714.6 kB view details)

Uploaded Source

Built Distribution

pysnr-0.0.1-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file pysnr-0.0.1.tar.gz.

File metadata

  • Download URL: pysnr-0.0.1.tar.gz
  • Upload date:
  • Size: 714.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for pysnr-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c17d7871d9d4cc9cfb84793106237480978639fb022c42e829d415d272f56a5d
MD5 9ff61950c24797f10be371af15c76a33
BLAKE2b-256 b93af8bf7e36e7ea3c5f13e7efb7eba3f70f1387f284ccbd703783194ff7d10c

See more details on using hashes here.

File details

Details for the file pysnr-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pysnr-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for pysnr-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1b871402633e869937b70999127c7250845059819e9327f999bccc32a6c9e23a
MD5 28212a58cd0afb84fb121cf0de6aaf21
BLAKE2b-256 ec2116520a6773e66266bad4b3b3fbfee498f7179a391d2ff1f61917df187c82

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page