WaveletWSE#

class pymultifracs.multiresquantity.WaveletWSE#

Bases: WaveletDec

Wavelet Weak Scaling Exponent.

It represents the \((\theta, \omega)\)-leaders of a signal: \(\ell^{(\theta, \omega)}(j, k)\).

Note

Should not be instantiated directly but instead created using the WaveletDec.get_wse() method.

Attributes:
valuesdict[int, ndarray]

values[j] contains the coefficients at the scale j. Arrays are of the shape (nj, n_rep)

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.

gamintfloat

Fractional integration used in the computation of the MRQ.

wt_namestr

Name of the wavelet used for the decomposition.

interval_sizeint

Width of the coef interval over which the MRQ was computed.

origin_mrqWaveletDec | None

If MRQ is derived from another mrq, refers to the original MRQ.

bootstrapped_objMultiResolutionQuantity | None

Storing the bootstrapped version of the MRQ if bootstraping has been used.

theta: float

Cone spread parameter in computing the WSE.

auto_integrate(scaling_ranges, weighted=None, idx_reject=None)#

Automatically integrates the signal to match the requirements of the multifractal formalism associated to the multi-resolution quantity.

Parameters:
scaling_rangeslist[tuple[int, int]]

List of pairs of \((j_1, j_2)\) ranges of scales for the analysis.

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.

idx_rejectdict[int, ndarray of bool]

Dictionary associating each scale to a boolean array indicating whether certain coefficients should be removed.

bootstrap(R, min_scale=1, idx_reject=None)#

Bootstrap the multi-resolution quantity by repeating.

Parameters:
Rint

Number of repetitions of the bootstrap.

min_scaleint

Minimum scale that will be kept in the bootstrapped MRQ, used to save memory space when analyzing the coarse scales of long time series.

idx_rejectdict[str, np.ndarray] | None

Dictionary of rejected values, by default None which means no rejected values.

Returns:
WaveletDec

MRQ containing the bootstrapped values.

classmethod bootstrap_multiple(R, min_scale, mrq_list)#

Bootstrap multiple MRQs at once

check_regularity(*args, **kwargs)#

Check that the MRQ has enough regularity for analysis

Returns:
None
freq2scale(freq, sfreq)#

Get the scales associated to frequencies.

Parameters:
freqfloat | ndarray

Frequencies to convert to scales.

sfreqfloat

Sampling frequency of the signal.

Returns:
scalesfloat | ndarray

Scales associated to freq.

get_formalism()#

Obtains the fomalism of the multi-resolution quantity

Returns:
formalismstr
get_leaders(p_exp, interval_size=3, gamint=None)#

Compute (p-)leaders from the wavelet coefficients

Parameters:
p_expfloat | numpy.inf

np.inf means wavelet leaders will also be computed, and a float sets the value of the p exponent implying a wavelet p-leader formalism.

interval_sizeint

Width of the time shift interval over which the leaders are computed, by default the usual value of 3.

gamintint | None

Fractional integration coefficient, by default None which means that current integration will be conserved.

Returns:
WaveletLeader

Wavelet (p-)leader derived from the coefficients.

get_n_bootstrap()#

Returns the number of bootstrapping repetition, or 0 if no bootstrapping

get_nj_interv(j1=None, j2=None, idx_reject=None)#

Returns nj as an array, for j in [j1,j2]

get_values(j, idx_reject=None)#

Get the values of the MRQ, applying any finite size effects corrections if necessary (Wavelet p-leaders).

get_wse(theta=0.5, omega=1, gamint=None)#

Compute weak scaling exponents from the wavelet coefficients

Parameters:
thetafloat, optional

Parameter controlling to which extent the cone reaches in the lower scales. Practically, \((\theta, \omega)\)-leaders computed at scale \(j\) reach down to \(j-j^{\theta}\).

omegafloat, optional

Parameter controlling the angle of the cone over which the weak scaling exponents are computed: practically, for computing the \((\theta, \omega)\)-leaders at scale \(j\), the width of the cone at scale \(j\prime\) is \((j-j\prime)^{omega} + 1\).

gamintfloat, optional

Fractional integration coefficient, defaults to 0 (no integration).

Returns:
WaveletWSE

Weak scaling exponent derived from the coefficients.

integrate(gamint)#

Re-compute the WSE on the fractionally integrated wavelet coefficients.

Parameters:
gamintfloat

Fractional integration coefficient

Returns:
integratedWaveletWSE
j2_eff()#

Returns the effective maximal scale

max_scale_bootstrap(idx_reject=None)#

Maximum scale at which bootstrapping can be done

Parameters:
idx_rejectdict[str, np.ndarray] | None

Dictionary of rejected values, by default None which means no rejected values.

Returns:
Scaleint
plot(j1, j2, ax=None, vmin=None, vmax=None, cbar=True, figsize=(4.5, 1.5), gamma=1, nan_idx=None, signal_idx=0, cbar_kw=None, cmap='magma')#

Plot the multi-resolution quantity.

Parameters:
j1int

Initial scale from which to display the values.

j2int

Maximal scale from which to display the values.

axmatplotlib.pyplot.axes | None

pyplot axes, defaults to None which creates a new figure.

vminfloat | None

Minimal value of the colorbar, by default None which uses the minimal value in the data.

vmaxfloat | None

Maximal value of the colorbar, by default None which uses the maximal value in the data.

cbarbool

Whether to display a colorbar.

figsizetuple, optional

Size of the figure, used if ax is None.

gammafloat, optional

Exponent of the power-law color normalization, set to 1 for no normalization.

nan_idxdict[str, ndarray] | None

Index of values to highlight (smart indexing), or boolean mask index of values to highlight as output by robust.get_outliers.

signal_idxint, optional

Index of the signal to plot, defaults to the first signal.

cbar_kwdict | None

Arguments to pass to the colorbar function call

cmapstr

Colormap for the plot.

scale2freq(scale, sfreq)#

Get the frequencies associated to scales.

Parameters:
scaleint | float | ndarray

Scales to convert to frequency.

sfreqfloat

Sampling frequency of the signal.

Returns:
freqfloat | ndarray

Frequencies associated to scales.