signals
Tools for signal processing.
canoncorr(X: FloatArray, Y: FloatArray) -> FloatArray
Canonical correlation between two subspaces.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X,
|
Y
|
The subspaces to compare. They should be of the same size. |
required |
Returns:
Name | Type | Description |
---|---|---|
corr |
FloatArray
|
array_like, Cosine of the principal angles. |
Notes
The canonical correlation between subspaces generalizes the idea of the angle between vectors to linear subspaces. It is defined as recursively finding unit vectors in each subspace that are maximally correlated [1]. Here, we compute the principal vectors and angles via the QR decomposition [2].
References
.. [1] Angles between flats. (2016, August 4). In Wikipedia, The Free Encyclopedia https://en.wikipedia.org/w/index.php?title=Angles_between_flats .. [2] Björck, Ȧke, and Gene H. Golub. "Numerical methods for computing angles between linear subspaces." Mathematics of computation 27.123 (1973): 579-594.
Source code in src/jetplot/signals.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
normalize(X: ArrayLike, axis: int = -1, norm: NormFunction = np.linalg.norm) -> NDArray[np.floating]
Normalizes elements of an array or matrix.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X
|
ArrayLike
|
The set of arrays to normalize. |
required |
axis
|
int
|
The axis along which to compute the norm (Default: -1). |
-1
|
norm
|
NormFunction
|
Function that computes the norm (Default: np.linalg.norm). |
norm
|
Returns:
Name | Type | Description |
---|---|---|
Xn |
NDArray[floating]
|
Arrays that have been normalized using to the given function. |
Source code in src/jetplot/signals.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
participation_ratio(C: np.ndarray) -> float
Compute the participation ratio of a square matrix.
Source code in src/jetplot/signals.py
39 40 41 42 43 44 45 46 47 48 49 50 |
|
smooth(x: ArrayLike, sigma: float = 1.0, axis: int = 0) -> NDArray[np.floating]
Smooths a 1D signal with a gaussian filter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
ArrayLike
|
array_like, The array to be smoothed |
required |
sigma
|
float
|
float, The width of the gaussian filter (default: 1.0) |
1.0
|
Returns: xs: array_like, A smoothed version of the input signal
Source code in src/jetplot/signals.py
16 17 18 19 20 21 22 23 24 25 26 |
|
stable_rank(X: NDArray[np.floating[Any]]) -> float
Computes the stable rank of a matrix
Source code in src/jetplot/signals.py
29 30 31 32 33 34 35 36 |
|