bcam.indar.ema.SuperResolution¶
- class bcam.indar.ema.SuperResolution(*, order: int = 2, rational_fitter={'method': 'AAA'}, damping: float = 0.0, fs: float = 1.0, prune_tol: float = 0.0, compute_amps: bool = True)¶
Spectral estimation based on rational fitting.
This class approximate a signal with an exponential sum. If
\[f_k = \sum_{j=0}^{M-1} a_j e^{\lambda_j k\,dt},\quad k = 0, \ldots, n-1,\]where \(a_j\) are the amplitudes, and \(\lambda_j\) are complex exponents, then the DFT is
\[e^{-2\pi i k/n}\hat{f}_k = \sum_{j=0}^{M-1} \frac{a_j(1-e^{\lambda_j n\,dt})}{e^{2\pi i k/n}-e^{\lambda_j\,dt}},\quad k = 0, \ldots, n-1,\]which enables the use of rational approximation. The algorithm follows a similar pattern as in ESPIRA.
- Parameters:
- orderint, default 2
Number of poles used by the internal rational fitter.
- rational_fitterdict, default {‘method’: ‘AAA’}
Configuration dictionary for the rational fitter. It must include the key
methodwith value'AAA'or'VF'. Any additional keys are forwarded to the selected estimator constructor.- dampingfloat, default 0.
Exponential damping factor applied to the time signal before fitting. Set to
0.to disable damping.- fsfloat, default 1.
Sampling frequency (\(= 1/dt\)) used to scale continuous-time exponents.
- prune_tolfloat, default 0.
Tolerance for pruning poles based on the norm of the fitted amplitudes.
- compute_ampsbool, default True
Whether to compute and store amplitudes after fitting poles.
- Attributes:
- poles_Poles
Estimated stable poles after optional pruning.
- amps_HCoeffs or None
Estimated amplitudes if
compute_amps=True; otherwiseNone.- exps_HCoeffs
Continuous-time exponents computed as
log(poles_) * fs.- n_poles_int
Number of poles identified by the internal rational fitter.
Methods
fit(y)Fit exponential sum.
Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
predict(X)Predict using the exponential sum.
set_params(**params)Set the parameters of this estimator.
- fit(y: array - like) SuperResolution¶
Fit exponential sum.
- Parameters:
- yarray-like, shape (n_samples, n_channels)
Time-domain signal to fit, where \(y_k\) is a vector of length n_channels for each time index \(k = 0, \ldots, n-1\).
- Returns:
- selfSuperResolution
Fitted estimator.
- get_metadata_routing()¶
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
- Returns:
- routingMetadataRequest
A
MetadataRequestencapsulating routing information.
- get_params(deep=True)¶
Get parameters for this estimator.
- Parameters:
- deepbool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators.
- Returns:
- paramsdict
Parameter names mapped to their values.
- predict(X: array - like) ndarray¶
Predict using the exponential sum.
- Parameters:
- Xarray-like, shape (n_eval_points,)
Time points at which to evaluate the exponential sum.
- Returns:
- fnp.ndarray, shape (n_eval_points, n_channels)
Predicted values. If compute_amps=False, then the returned values are NaN.
- set_params(**params)¶
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as
Pipeline). The latter have parameters of the form<component>__<parameter>so that it’s possible to update each component of a nested object.- Parameters:
- **paramsdict
Estimator parameters.
- Returns:
- selfestimator instance
Estimator instance.