Baseline estimation and subtraction using Baseline Estimation And Denoising using Sparsity(BEADS)(implementation).
More...
#include <algorithm>
#include <cmath>
#include <functional>
#include "../misc/convolve.h"
#include "../misc/diff.h"
#include "../misc/spdiags.h"
#include "beads.h"
Go to the source code of this file.
|
| const std::tuple< std::vector< double >, std::vector< double > > | sablib::BaselineBeads (const std::vector< double > &y, const unsigned int s, const double frequency, const double r, const double lambda0, const double lambda1, const double lambda2, const unsigned int loop=30, const double eps=1e-3, const BeadsPenalty penalty=BeadsPenalty::L1_v2) |
| | Performs baseline estimation and denoising using Sparsity (BEADS).
|
| const std::vector< double > | sablib::BeadsExpandBoundaries (const std::vector< double > &y, const unsigned int n=400) |
| | Expands the signal boundaries by padding with a tapered sequence.
|
| const std::vector< double > | sablib::BeadsTrimBoundaries (const std::vector< double > &y, const unsigned int n=400) |
| | Trims the expanded signal boundaries.
|
Baseline estimation and subtraction using Baseline Estimation And Denoising using Sparsity(BEADS)(implementation).
- Author
- Izadori
- Note
- This file includes code derived from Duval's MATLAB implemetation. Original MATLAB code is licensed under BSD 3-Clause License.
Definition in file beads.cpp.
◆ _USE_MATH_DEFINES
| #define _USE_MATH_DEFINES |
◆ BaselineBeads()
| const std::tuple< std::vector< double >, std::vector< double > > sablib::BaselineBeads |
( |
const std::vector< double > & | y, |
|
|
const unsigned int | s, |
|
|
const double | frequency, |
|
|
const double | r, |
|
|
const double | lambda0, |
|
|
const double | lambda1, |
|
|
const double | lambda2, |
|
|
const unsigned int | loop = 30, |
|
|
const double | eps = 1e-3, |
|
|
const BeadsPenalty | penalty = BeadsPenalty::L1_v2 ) |
Performs baseline estimation and denoising using Sparsity (BEADS).
- Parameters
-
| y | The input data. |
| s | Order of the derivative for baseline sparsity (typically 1 or 2). |
| frequency | Sampling frequency of the signal. |
| r | High-pass filter parameter (cut-off frequency relative to sampling frequency). |
| lambda0 | Sparsity parameter for the baseline. |
| lambda1 | Sparsity parameter for the first-order derivative of the signal. |
| lambda2 | Sparsity parameter for the second-order derivative of the signal. |
| loop | Maximum number of iterations. |
| eps | Convergence threshold. |
| penalty | Penalty type (L1_v1 or L1_v2). |
- Returns
- A tuple containing (baseline, denoised signal).
- Exceptions
-
| std::invalid_argument | One or more parameters are wrong. |
Definition at line 101 of file beads.cpp.
◆ BeadsExpandBoundaries()
| const std::vector< double > sablib::BeadsExpandBoundaries |
( |
const std::vector< double > & | y, |
|
|
const unsigned int | n = 400 ) |
Expands the signal boundaries by padding with a tapered sequence.
- Parameters
-
| y | The input data vector. |
| n | The number of elements to add at each end. |
- Returns
- A expanded vector.
- Exceptions
-
| std::invalid_argument | The length of y is zero. |
Definition at line 257 of file beads.cpp.
◆ BeadsTrimBoundaries()
| const std::vector< double > sablib::BeadsTrimBoundaries |
( |
const std::vector< double > & | y, |
|
|
const unsigned int | n = 400 ) |
Trims the expanded signal boundaries.
- Parameters
-
| y | The input data vector (expanded signal). |
| n | The number of elements to trim from each end. |
- Returns
- A trimmed vector.
- Exceptions
-
| std::invalid_argument | The length of y is zero or less than `2 * n`. |
Definition at line 282 of file beads.cpp.