Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

README.md

DOI

1D Spectrum Denoiser

The Denoising algorithm is essentially derived from singular value decomposition (SVD). By first constructing a partial circulant matrix using the spectral data, the noise components are discriminated after SVD of the matrix. A smoother spectrum is reconstructed from a low-rank approximation of the matrix using only the signal components.

The code is completely written in Python, with numerical support by the standard packages SciPy and NumPy. It offers two operational modes, i.e., layman and expert. In the layman mode, the code works out-of-the-box once a user has fed with an input spectrum. Afterwards, it will autonomously produce the optimal smoothed spectrum. Whereas with the expert mode, the user owns full control of the code. He/She is able to fine-tune every denoising parameters during the process. This can especially be useful in certain scenarios, e.g., debugging.

Prerequisites

  • Python 3
  • SciPy, NumPy
  • Matplotlib (optional, only if visualization is needed)

Inventory

class Denoiser(mode = "layman"|"expert")

attributes

  • mode: current running mode
  • s: singular values
  • U: left singular vectors
  • r: rank of the approximating matrix

method

denoise(sequence, layer, gap, rank)

  • arguments
    • sequence: noisy data sequence
    • layer: number of rows of the constructed matrix
    • gap: (expected only in expert mode) boundary level difference of the sequence, right - left
    • rank: (expected only in expert mode) rank of the approximating matrix
  • return
    • denoised: smoothed sequence

Example

Imagine now a clean sinc signal is corrupted by an additive Gaussian white noise, which results in a noisy sequence of length 5000. To denoise the sequence, we just need two lines.

denoiser = Denoiser() # instantiate the class
denoised_sequence = denoiser.denoise(sequence, 1000) # 1000 defines the number of rows of the constructed matrix

The denoising performance at different signal-to-noise ratios (SNRs) is demonstrated in the figure below. Note that when the noise is absent, the signal is perfectly restored. When the signal is absent, the noise mean is returned, which agrees with one's intuition.

quintet

Reference

X.C. Chen et al., Phys. Rev. E 99, 063320 (2019).

License

This repository is licensed under the GNU GPLv3.

About

A generic denoising method for 1D spectra based on singular value decomposition

Topics

Resources

License

Packages

No packages published

Languages

You can’t perform that action at this time.