Digital Signal Processing¶
The CR-Nimble
library has some handy digital signal processing routines
implemented in JAX. They are available as part of the cr.nimble.dsp
package.
Signal Energy¶
|
Computes the energy of the signal along the specified axis |
Thresholding¶
|
Returns the indices and corresponding values of largest K non-zero entries in a vector x |
|
Returns the sorted indices and corresponding values of largest K non-zero entries in a vector x |
|
Sets all entries in x to be zero which are less than t in magnitude |
|
Returns the locations of all entries in x which are larger than t in magnitude |
|
Keeps only as much coefficients in signal so as to capture a fraction of signal energy |
|
Hard thresholding as per [CCSW14] |
|
Soft thresholding as per [CCSW14] |
|
Half thresholding as per [CCSW14] |
|
Percentile hard thresholding as per [CCSW14] |
|
Percentile soft thresholding as per [CCSW14] |
|
Percentile half thresholding as per [CCSW14] |
|
Converts gamma to tau for half thresholding as per [CCSW14] |
|
Converts gamma to tau for hard thresholding as per [CCSW14] |
Scaling¶
|
Scales a signal to the range of 0 and 1 |
|
Normalizes a data vector (data - mu) / sigma |
Quantization¶
|
Quantizes a signal to n bits where signal values are bounded by 1 |
Spectrum Analysis¶
|
Returns the normalized frequency |
|
Frequency spectrum of 1D data using FFT |
|
Power spectrum of 1D data using FFT |
Interpolation¶
|
Interpolates x to n points in Fourier Transform domain |
Windowing¶
|
Converts a signal into sliding windows (per row) with the specified overlap |
|
Converts a signal into sliding windows (per column) with the specified overlap |
Sparse Signals¶
Following functions analyze, transform, or construct signals which are known to be sparse.
Returns the values of non-zero entries in x |
|
Returns the indices of non-zero entries in x |
|
|
Returns the indices of non-zero entries in x |
|
Returns the indices of K largest entries in x by magnitude |
|
Keeps only largest K non-zero entries by magnitude in a vector x |
|
Builds a sparse signal from its non-zero entries (specified by their indices and values) |
Matrices of Sparse Signals¶
Following functions analyze, transform, or construct collections of sparse signals organized as matrices.
|
Randomizes the rows in X |
|
Randomizes the columns in X |
Sparse representation matrices (row-wise)
|
Picks K entries from each row of X specified by indices matrix |
|
Returns the indices of K largest entries by magnitude in each row of X |
|
Keeps only largest K non-zero entries by magnitude in each row of X |
Sparse representation matrices (column-wise)
|
Picks K entries from each column of X specified by indices matrix |
|
Returns the indices of K largest entries by magnitude in each column of X |
|
Keeps only largest K non-zero entries by magnitude in each column of X |
Artificial Noise¶
|
Generates noise for the signal at the specified SNR based on signal energy |
|
Generates noise for the signal at the specified SNR based on std ratio |
Synthetic Signals¶
Generates a pulse signal which is 1 between start and end times and 0 everwhere else |
|
Generates a transient sinusoid between start and end times |
|
Generates a decaying sinusoid :param fs: Sample rate of signal in Hz. |
|
Generates a frequency sweep from low to high over time. |
|
Generates a frequency sweep from low to high over time defined by central frequency and bandwidth. |
|
Generates a Gaussian modulated sinusoid |
|
Generates a picket fence signal |
|
Returns a HeaviSine signal as proposed by Donoho et al. in Wavelab. |
|
Returns a Bumps signal as proposed by Donoho et al. in Wavelab. |
|
Returns a Blocks signal as proposed by Donoho et al. in Wavelab. |
|
Returns a Doppler signal as proposed by Donoho et al. in Wavelab. |
|
Returns a Ramp signal as proposed by Donoho et al. in Wavelab. |
|
Returns a Cusp signal as proposed by Donoho et al. in Wavelab. |
|
Returns a Sing signal as proposed by Donoho et al. in Wavelab. |
|
Returns a HiSine signal as proposed by Donoho et al. in Wavelab. |
|
Returns a LoSine signal as proposed by Donoho et al. in Wavelab. |
|
Returns a LinChirp signal as proposed by Donoho et al. in Wavelab. |
|
Returns a TwoChirp signal as proposed by Donoho et al. in Wavelab. |
|
Returns a QuadChirp signal as proposed by Donoho et al. in Wavelab. |
|
Returns a MishMash signal as proposed by Donoho et al. in Wavelab. |
|
Returns a WernerSorrows signal as proposed by Donoho et al. in Wavelab. |
|
Returns a Leopold signal as proposed by Donoho et al. in Wavelab. |
Discrete Cosine Transform¶
Computes the 1D Type-II DCT transform |
|
Computes the 1D Type-II Inverse DCT transform |
|
Computes the 1D Type-II DCT transform such that the transform is orthonormal |
|
Computes the 1D Type-II IDCT transform such that the transform is orthonormal |
Fast Walsh Hadamard Transform¶
There is no separate Inverse Fast Walsh Hadamard Transform as FWHT is the inverse of
itself except for a normalization factor.
In other words, x == fwht(fwht(x)) / n
where n is the length of x.
Computes the Fast Walsh Hadamard Transform over columns |
Utilities¶
Returns a sequence of time values sampled at a specific frequency for a specific duration |