pytspl.filters.base_filter
Base filter.
Classes
Base filter class for designing linear filters. |
Module Contents
- class pytspl.filters.base_filter.BaseFilter(simplicial_complex: pytspl.simplicial_complex.SimplicialComplex)[source]
Base filter class for designing linear filters.
- sc
- history
- set_history(filter: numpy.ndarray, f_estimated: numpy.ndarray, frequency_responses: numpy.ndarray, extracted_component_error: numpy.ndarray, filter_error: numpy.ndarray = np.array([])) None[source]
Set the history of the filter design.
- static calculate_error_NRMSE(f_estimated: numpy.ndarray, f_true) float[source]
Calculate the error of the estimated signal using NRMSE.
- static logistic_function(cut_off_frequency: float = 0.01, steep: int = 100) numpy.ndarray[source]
Compute the logistic function for the given input.
- Args:
cut_off_frequency (float): The cut-off frequency. steep (int): The steepness of the logistic function.
- Returns:
np.ndarray: The logistic function output.
- static power_iteration(P: numpy.ndarray, iterations: int = 50) numpy.ndarray[source]
Power iteration algorithm to approximate the largest eigenvalue.
- Args:
P (np.ndarray): The input matrix. iterations (int): The number of iterations.
- Returns:
np.ndarray: The approximated largest eigenvalue.
- get_true_signal(f: numpy.ndarray, component: str) numpy.ndarray[source]
Get the true signal for the component.
- Args:
f (np.ndarray): The signal to be filtered. component (str): The component to be extracted.
- Returns:
np.ndarray: The true signal.
- get_p_matrix(p_choice: str = 'L1') scipy.sparse.csr_matrix[source]
Get the matrix P for the filter design. The matrix P can be the Laplacian matrix, the lower Laplacian matrix, or the upper Laplacian matrix.
- Args:
p_choice (str, optional): The choice of matrix P. Defaults to “L1”. Choose from [‘L1’, ‘L1L’, ‘L1U’].
- Raises:
ValueError: Invalid P_choice.
- Returns:
csr_matrix: The matrix P.
- get_component_coefficients(component: str) numpy.ndarray[source]
Calculate the component coefficients of the given component using the order of the eigenvectors.
- Args:
component (str): Component of the eigendecomposition to return.
- Raises:
ValueError: If the component is not one of ‘harmonic’, ‘curl’, or ‘gradient’.
- Returns:
np.ndarray: The component coefficients of the simplicial complex for the given component.