StructureFunction#
- class pymultifracs.scalingfunction.StructureFunction#
Bases:
ScalingFunctionContains the structre functions and their linear fit.
Note
Should not be instanciated but instead obtained from calling
pymultifracs.mfa()- Attributes:
- j
ndarray, shape (n_j) Values of j covered by the analysis.
- 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-leaders’.
- n_channel
int Number of underlying signals in the wavelet decomposition. May not match the dimensionality of the values arrays in case there are multiple repetitions associated to a single signal.
- q
ndarray, shape (n_moments) \(q\) values for which the structure functions are computed.
- values
ndarray, shape (n_moments, n_j, n_scaling_ranges,n_rep) \(S_q(j, k)\).
- scaling_ranges
list[tuple[int,int]] List of pairs of scales \((j_1, j_2)\) delimiting the temporal scale support over which the estimates are regressed.
- slope
ndarray, shape (n_moments, n_scaling_ranges,n_rep) \(s_q\).
- H
ndarray \(H = s_2 / 2\).
- intercept
ndarray, shape (n_moments, n_scaling_ranges,n_rep) Intercept of the linear regression.
- 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
StructureFunction|None Storing the bootstrapped version of the structure function if bootstraping has been used.
- j
- S_q(q)#
Returns \(S_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.
- plot(nrow=4, filename=None, ignore_q0=True, figsize=None, scaling_range=0, plot_scales=None, plot_CI=True, signal_idx=0)#
Plots the structure functions.
- Parameters:
- nrow
int Number of rows in the plot.
- filename
str|None If not None, the file is saved to filename
- ignore_q0bool
Whether to include the structure function for \(q=0\), which is always going to be a constant function valued 1. Defaults to True.
- figsize
tuple[int,int] |None Size of the figure, in inches.
- scaling_range
int If multiple scaling ranges were used in fitting, indicates the index to use.
- plot_scales
tuple[int,int] |None Takes a tuple of the form \((j_1, j_2)\): Constrains the x-axis to the interval \([j_1, j_2]\).
- plot_CIbool
If using bootstrap, plot bootstrap-derived confidence interval on the structure function.
- signal_idx
int If using a multivariate signal, index of the signal to plot.
- nrow
- plot_scaling(filename=None, ax=None, signal_idx=0, range_idx=0, **plot_kw)#
Plots the scaling function \(\zeta(q)\).
- Parameters:
- filename
str|None If not None, saves the figure to filename.
- ax
Axes|None Provides the axes on which to draw the function. Defaults to None, which creates a new figure.
- 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.
- **plot_kw
dict Extra arguments forwarded to the plot function call.
- filename
- s_q(q)#
Returns \(s_q\) for given
q.