Undocumented
Static Method | diagsums |
Diagonally sum matrices a and b . This is practically the same as convolution using FFT. |
Static Method | eigval |
Calculate single value decomposition from eigenvalues |
Method | __init__ |
Set up initial values of useful constants |
Method | embed |
Peform embedding of our data, a, into the trajectory matrix, self.X. |
Method | get |
Define how the eigentriples (evals, evecs, fvecs) should be grouped. |
Method | group |
Perform the actual grouping of decomposed elements |
Method | plot |
Plot all details of SSA. Makes lots of plots |
Method | plot |
Plots grouped decomposed trajectory matrix of SSA |
Method | plot |
Plots grouped decomposed trajectory matrix of SSA |
Method | plot |
Plots eigenvectors (left singular vectors) of SSA |
Method | plot |
Plots factorvectors (right singular vectors) of SSA |
Method | plot |
Plots an overview of the SSA results |
Method | plot |
Plots SVD used in SSA |
Method | plot |
Plots decomposed trajectory matrix of SSA |
Method | plot |
Plots grouped decomposed trajectory matrix of SSA |
Method | quasi |
Reverses the embedding map, faster than the direct method but less accurate. Is almost always good enough. |
Method | reverse |
Reverses the embedding map. This version is slow but more accurate, use quasi_hankelisation instead in most applications |
Instance Variable | a |
Undocumented |
Instance Variable | d |
Undocumented |
Instance Variable | grouping |
Undocumented |
Instance Variable | k |
Undocumented |
Instance Variable | K |
Undocumented |
Instance Variable | l |
Undocumented |
Instance Variable | L |
Undocumented |
Instance Variable | m |
Undocumented |
Instance Variable | n |
Undocumented |
Instance Variable | N |
Undocumented |
Instance Variable | ndim |
Undocumented |
Instance Variable | s |
Undocumented |
Instance Variable | u |
Undocumented |
Instance Variable | v |
Undocumented |
Instance Variable | X |
Undocumented |
Instance Variable |
|
Undocumented |
Instance Variable |
|
Undocumented |
def diagsums(a:
Array_2D
, b: Array_2D
, mode: Convolution_Mode_literals
= 'full', fac: int | float
= 1) -> Array_2D
:
¶
Diagonally sum matrices a
and b
. This is practically the same as convolution using FFT.
- # ARGUMENTS #
a : Array_2D b : Array_2D mode : Convolution_Mode_literals = 'full'
Convolution mode to use
- fac : int | float = 1
- Factor to multiply convolution by.
- # RETURNS #
- conv : Array_2D
- Diagonal sum of
a
andb
Array_1D | Array_2D
, w_shape: None | int | tuple[ N] | tuple[ N, M]
= None, svd_strategy: SVD_Strategy_Literals
= 'eigval', rev_mapping: Reverse_Mapping_Strategy_Literals
= 'fft', grouping: dict[ str, Any]
= {None | int
= None):
¶
Set up initial values of useful constants
# ARGUMENTS #
- a : [nx] | [nx,ny]
- Array to operate on, should be 1D or 2D.
- w_shape : None | int | [wx] | [wx, wy]
- Window shape to use for SSA, no array is actually created from this shape, it's used as indices to loops etc. If not given, will use a.shape//4 as window size
- svd_strategy : 'eigval' | 'numpy'
- How should we calculate single value decomposition, 'eigval' is fastest and uses least memory so it's normally the best choice.
- rev_mapping : 'fft' | 'direct'
- How should we reverse the embedding? 'fft' is fastest so normally best.
- grouping : dict[str, Any]
How should we group the tarjectory matricies? Values other than 'elementary' do not give exact results. Some modes require extra arguments detailed below:
- ## Required Keys ##
- 'mode' : 'elementary'
'pairs''pairs_after_first''similar_eigenvalues''blocks_of_n'Required to set the mode, default is 'elementary'. Values other than 'elementary' do not give exact results. Some values require extra keys.
- ### Required for 'mode'='similar_eigenvalues' ###
- 'tolerance' : float
- Maximum fractional difference that two eigenvalues can have if their eigenvectors are to be grouped into one eigenvector.
- ### Required for 'mode'='blocks_of_n' ###
- 'n' : int
- Number of eigenvectors to be grouped together in each group.
- n_eigen_values : None | int
- Number of eigenvalues/vectors that should be used in calculations.
None
means to use all of them.
# RETURNS #
Nothing, but the object will hold the single spectrum analysis of the array 'a' in self.X_ssa
Define how the eigentriples (evals, evecs, fvecs) should be grouped.
- # ARGUMENTS #
- mode : str
- How the grouping will be performed
- **kwargs : Dict[str,Any]
- Data required depending upon mode, see SSA.__init__ docstring for details
- # RETURNS #
- grouping : list[list[int]]
- List of indices that will make up each group.
Perform the actual grouping of decomposed elements
Takes lists of indices from self.grouping
, and sums decomposed elements with those indices
i.e., self.grouping=[[0], [1,2,3], [4,5,6,7], [9]]
then grouped components are X_g = [ X_0, X_1+X_2+X_3, X_4+X_5+X_6+X_7, X_9]
- # ARGUMENTS #
- None, but uses
self.X_decomp
,self.u
,self.s
,self.v_star
,self.grouping
,self.d
,self.m
- # RETURNS #
- X_g : Array_3D
- Grouped matrixes
- u_g : Array_2D
- Grouped left singular vectors
- v_star_g : Array_2D
- Grouped right singular vectors
- s_g : Array_2D
- Grouped singular values
Reverses the embedding map, faster than the direct method but less accurate. Is almost always good enough.
- # RETURNS #
- X_ssa : Array_2D | Array_3D
- 2D (for 1D input data) or 3D (for 2D input data) singular spectrum analysis components. First index is the component number.