MFSpectrum#
- class pymultifracs.scalingfunction.MFSpectrum#
Bases:
ScalingFunctionEstimates the Multifractal Spectrum
Based on equations 2.74 - 2.78 of Herwig Wendt’s thesis [1]
Note
Should not be instanciated but instead obtained from calling
pymultifracs.mfa()- Attributes:
- formalism
str Formalism used. Can be any of ‘wavelet coefs’, ‘wavelet leaders’, or ‘wavelet p-leaders’.
- j
ndarray, shape (n_scales,) List of the j values (scales), in order presented in the value arrays.
- nj
dict[int,ndarray] Dictionnary giving the number of non-NaN values at every scale. Array are of 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’, or ‘wavelet p-leadParameters ———-
- figsize: (int, int) | None
If not None, indicates the size of the figure.
- nrowint
Number of rows of the figure.
- j1int
Constrains the plot to scales \(j \geq j_1\).
- filenamestr | None
If not None, saves the figure to
filename.- signal_idxint
If using a multivariate signal, index of the signal to plot.
- range_idxint
If multiple scaling ranges were used in fitting, indicates the index to use.
- **kwargsdict
Optional arguments sent to
pymultifracs.viz.plot_cumulants().[Tuple[int]]
List of pairs of (j1, j2) ranges of scales for the analysis
- Dq
ndarray, shape (n_exponents,n_rep) Fractal dimensions : \(D(q)\), y-axis of the multifractal spectrum
- hq
ndarray, shape (n_exponents,n_rep) Hölder exponents : \(h(q)\), x-axis of the multifractal spectrum
- weighted
str|None Weighting mode for the linear regressions. Defaults to None, which is no weighting. Possible values are ‘Nj’ which weighs by number of coefficients, and ‘bootstrap’ which weights by bootstrap-derived estimates of variance.
- weights
ndarray Weights of the linear regression.
- bootstrapped_obj
MFSpectrum|None Storing the bootstrapped version of the structure function if bootstraping has been used.
- formalism
References
[1]H. Wendt (2008). Contributions of Wavelet Leaders and Bootstrap to Multifractal Analysis: Images, Estimation Performance, Dependence Structure and Vanishing Moments. Confidence Intervals and Hypothesis Tests. Ph.D thesis, Laboratoire de Physique, Ecole Normale Superieure de Lyon. https://www.irit.fr/~Herwig.Wendt/data/ThesisWendt.pdf
- D_q()#
Returns \(\mathcal{L}(q)\).
- U_q(q)#
Returns \(U_q(j)\) for given
q.
- V_q(q)#
Returns \(V_q(j)\) for given
q.
- 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.
- h_q()#
Returns \(h(q)\).
- plot(filename=None, ax=None, fmt='ko-', range_idx=0, signal_idx=0, shift_gamint=False, **plot_kwargs)#
Plot the multifractal spectrum.
- Parameters:
- filename
str|None If not None, saves the figure to
filename.- ax
Axes|None Axes where to plot the spectrum. Defaults to None, which creates a new figure.
- fmt
str Format string for the plot.
- range_idx
int If multiple scaling ranges were used in fitting, indicates the index to use.
- signal_idx
int If using a multivariate signal, index of the signal to plot.
- shift_gamintbool
If fractional integration was used, shifts the spectrum on the x-axis by \(-\gamma\).
- **plot_kwargs
dict Optional arguments sent to the plotting function
plt.plot().
- filename