pencil.math.stats

Differential operators in different coordinate systems.

Submodules

Functions

space_struct(arr[, dims, Dorder, dirs, lperi, lplot, ...])

Calculate the structure function in space.

time_struct(arr[, time, order, lplot, InitialGuess, ...])

Calculate the structure function in time.

fit_gaussm1(ell, sigma, L0)

Fit for 2nd order structure function, Eq. 6 DOI 10.3847/1538-4357/aa93e7

fit_expm1(t, sigma, L0)

Fit for 2nd order structure function, Eq. 5 DOI 10.3847/1538-4357/aa93e7

fit_gauss(ell, sigma, L0)

Fit for 2nd order structure function, Eq. 6 DOI 10.3847/1538-4357/aa93e7

fit_exp(t, sigma, L0)

Fit for 2nd order structure function, Eq. 5 DOI 10.3847/1538-4357/aa93e7

fit_power(t, sigma, L0)

Fit for 2nd order structure function, Eq. 5 DOI 10.3847/1538-4357/aa93e7

fit_linear(t, sigma, L0)

Fit for 2nd order structure function, Eq. 5 DOI 10.3847/1538-4357/aa93e7

Package Contents

pencil.math.stats.space_struct(arr, dims=[[], [], []], Dorder=2, dirs='zyx', lperi=(True, True, True), lplot=True, InitialGuess=[1.0, 1.0], deltay=0.0, chunksize=1000.0, figname=None, dlabel='data', quiet=True, downsample=[1, 1, 1], maxl=[-1, -1, -1], loopsample=[1, 1, 1])

Calculate the structure function in space.

call signature:

space_struct(arr, dims=[[],[],[]], Dorder=2, dirs=’zyx’,

lperi=(True,True,True), lplot=True, InitialGuess = [1.0,1.0], deltay=0., figname = None, dlabel = ‘data’, quiet=False)

Keyword arguments:

arr:

numpy data array of shape, e.g., [nz,ny,nz].

z:

z dimension full array to replace default empty list.

y:

y dimension full array to replace default empty list.

x:

x dimension full array to replace default empty list.

Dorder:

Order of structure function, by default 2nd.

lperi:

Flag indicates for each dimension, whether boundary is periodic.

lplot

Flag to plot the result.

InitialGuess:

Initial parameters for curve fitting, default [1.0,1.0].

figname:

String name for plot, if saving rather than only display.

dlabel:

legend label for data.

quiet

Flag for switching off output.

Return type:

D1 Structure function, length array, fit parameters [sigma, L0].

Notes

Must provide list of dimension arrays to match dirs required.

Examples

>>> D,ell,fit = pc.math.stats.space_struct(var.rho, dims=[gd.z,gd.y,gd.x],
                                           dirs='zyx')
>>> D, ell, fit
[0, ...,], [0, 0.0041, ...], [2.5,0.04]
pencil.math.stats.time_struct(arr, time=[], order=2, lplot=True, InitialGuess=[1.0, 1.0], figname=None, dlabel='data', quiet=False)

Calculate the structure function in time.

call signature:

time_struct(arr, time=[], order=2, lplot=True, InitialGuess = [1.0,1.0],

figname = None, dlabel = ‘data’, quiet=False)

Keyword arguments:

arr:

numpy data array of shape [ntime,:].

time:

time series for time correlations. By default empty list.

Dorder:

Order of structure function, by default 2nd.

lplot

Flag to plot the result.

InitialGuess:

Initial parameters for curve fitting, default [1.0,1.0].

figname:

String name for plot, if saving rather than only display.

dlabel:

legend label for data.

quiet

Flag for switching off output.

Return type:

D1 Structure function, time array, fit parameters [sigma, L0].

Notes

Provide time series of D1 – D3 sample sets of fixed spatial location.

Examples

>>> Dt,t,fit = pc.math.stats.space_struct(var.rho, dims=[gd.z,gd.y,gd.x],
                                           dirs='zyx')
>>> Dt, t, fit
[0, ...,], [0, 0.0041, ...], [2.5,0.04]
pencil.math.stats.fit_gaussm1(ell, sigma, L0)

Fit for 2nd order structure function, Eq. 6 DOI 10.3847/1538-4357/aa93e7 correlation length = sqrt(pi/2)L0

pencil.math.stats.fit_expm1(t, sigma, L0)

Fit for 2nd order structure function, Eq. 5 DOI 10.3847/1538-4357/aa93e7 correlation length = L0

pencil.math.stats.fit_gauss(ell, sigma, L0)

Fit for 2nd order structure function, Eq. 6 DOI 10.3847/1538-4357/aa93e7 correlation length = sqrt(pi/2)L0

pencil.math.stats.fit_exp(t, sigma, L0)

Fit for 2nd order structure function, Eq. 5 DOI 10.3847/1538-4357/aa93e7 correlation length = L0

pencil.math.stats.fit_power(t, sigma, L0)

Fit for 2nd order structure function, Eq. 5 DOI 10.3847/1538-4357/aa93e7 correlation length = L0

pencil.math.stats.fit_linear(t, sigma, L0)

Fit for 2nd order structure function, Eq. 5 DOI 10.3847/1538-4357/aa93e7 correlation length = L0