Cumulants#
- class pymultifracs.scalingfunction.Cumulants#
Bases:
ScalingFunctionComputes and analyzes cumulant.
Note
Should not be instanciated but instead obtained from calling
pymultifracs.mfa()- Attributes:
- j
ndarrayofint, shape (n_j,) List of the j values (scales), in order presented in the value arrays.
- nj
ndarrayofint, shape (n_j,) Dictionnary giving the number of non-NaN values at every scale. Arrays are of the shape (n_rep,).
- gamint
float Value of gamint used in the computation of the underlying MRQ.
- formalism
str Formalism used. Can be any of: ‘wavelet coefs’, ‘wavelet leaders’, ‘wavelet p-leaders’, or ‘weak scaling exponent’.
- n_channel
int Number of underlying signals in the wavelet decomposition. May not match the dimensionality of the values arrays (n_rep) in case there are multiple repetitions associated to a single signal, for instance in bootstrapping.
- n_cumul
int Maximum order of the computed cumulants.
- m
ndarrayofint, shape (n_cumul,) Cumulant order values \(m\), in the order used internally.
- values
ndarrayoffloat, shape (n_cumulants,n_scales,n_rep) \(C_m(j)\).
- scaling_ranges
List[(int,int)] List of pairs of scales delimiting the temporal scale support over which the estimates are regressed.
- log_cumulants
ndarray, shape (n_cumulants,n_rep) \((c_m)_m\), slopes of the curves \(j \times C_m(j)\).
- var_log_cumulants
ndarray, shape (n_cumulants,n_rep) Estimates of the variance of log-cumulants.
- weighted
str|None Weighting mode for the linear regressions. Defaults to None, which means no weighting. Possible values are
'Nj'which weighs by number of coefficients, and ‘bootstrap’ which weights by bootstrap-derived estimates of variance.- weights
ndarrayoffloat, shape () #TODO:plotshape ofweightshere Weights of the linear regression.
- bootstrapped_obj
Cumulants|None Storing the bootstrapped version of the structure function if bootstraping has been used.
- j
- compute_Lambda()#
Computes \(\Lambda\) for bootstrap-based automated range selection. [1]
References
- compute_R()#
Computes \(R\) for bootstrap-based automated range selection.
- compute_R2()#
Computes \(R^2\) for the estimated linear regressions.
- compute_RMSE()#
Computes root mean square error for the estimated linear regressions.
- find_best_range(per_moment=False)#
Find the best range among those computed, given bootstrap was already performed
- Parameters:
- per_momentbool
If True, returns the best range for each moment. Otherwise, by default returns the overall best range for all moments.
References
- get_jrange(j1=None, j2=None, bootstrap=False)#
Sanitize the scaling range \([j_1, j_2]\) and find the associated indices in the
mrq.jarray.
- get_n_bootstrap()#
Returns the number of bootstrapping repetition, or 0 if no bootstrapping
- get_nj_interv(j_min, j_max)#
Returns the number of coefficients on an interval of temporal scales.
- plot(figsize=None, nrow=3, j1=None, filename=None, range_idx=0, n_cumul=None, signal_idx=0, **kwargs)#
Plots the \(C_m(j)\) and their associated \(c_m\) fits.
- Parameters:
- figsize: (int, int) | None
If not None, indicates the size of the figure.
- nrow
int Number of rows of the figure.
- j1
int Constrains the plot to scales \(j \geq j_1\).
- filename
str|None If not None, saves the figure to
filename.- signal_idx
int If using a multivariate signal, index of the signal to plot.
- range_idx
int If multiple scaling ranges were used in fitting, indicates the index to use.
- **kwargs
dict Optional arguments sent to
pymultifracs.viz.plot_cumulants().