StructureFunction#

class pymultifracs.scalingfunction.StructureFunction#

Bases: ScalingFunction

Contains the structre functions and their linear fit.

Note

Should not be instanciated but instead obtained from calling pymultifracs.mfa()

Attributes:
jndarray, shape (n_j)

Values of j covered by the analysis.

njdict[int, ndarray]

Dictionnary giving the number of non-NaN values at every scale. Array are of shape (n_rep)

gamintfloat

Value of gamint used in the computation of the underlying MRQ.

formalismstr

Formalism used. Can be any of ‘wavelet coefs’, ‘wavelet leaders’, or ‘wavelet p-leaders’.

n_channelint

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.

qndarray, shape (n_moments)

\(q\) values for which the structure functions are computed.

valuesndarray, shape (n_moments, n_j, n_scaling_ranges, n_rep)

\(S_q(j, k)\).

scaling_rangeslist[tuple[int, int]]

List of pairs of scales \((j_1, j_2)\) delimiting the temporal scale support over which the estimates are regressed.

slopendarray, shape (n_moments, n_scaling_ranges, n_rep)

\(s_q\).

Hndarray

\(H = s_2 / 2\).

interceptndarray, shape (n_moments, n_scaling_ranges, n_rep)

Intercept of the linear regression.

weightedstr | 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.

weightsndarray

Weights of the linear regression.

bootstrapped_objStructureFunction | None

Storing the bootstrapped version of the structure function if bootstraping has been used.

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.j array.

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:
nrowint

Number of rows in the plot.

filenamestr | 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.

figsizetuple[int, int] | None

Size of the figure, in inches.

scaling_rangeint

If multiple scaling ranges were used in fitting, indicates the index to use.

plot_scalestuple[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_idxint

If using a multivariate signal, index of the signal to plot.

plot_scaling(filename=None, ax=None, signal_idx=0, range_idx=0, **plot_kw)#

Plots the scaling function \(\zeta(q)\).

Parameters:
filenamestr | None

If not None, saves the figure to filename.

axAxes | None

Provides the axes on which to draw the function. Defaults to None, which creates a new figure.

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.

**plot_kwdict

Extra arguments forwarded to the plot function call.

s_q(q)#

Returns \(s_q\) for given q.