Data handlers (data
)#
The general scheme is to use the following:
uv, xv -> samples (values) for u, x
u, xu -> averages of u and x*u
u[i] = <u**i>
xu[i] = <x * u**i>
xu[i, j] = <d^i x/d beta^i * u**j
Classes:
Basic version of DataCallbackABC. |
|
Base class for handling callbacks to adjust data. |
|
|
Data class using |
|
Data object based on central co-moments array. |
Functions:
|
Factory function to produce a DataCentralMomentsVals object. |
- class thermoextrap.data.DataCallback[source]#
Bases:
DataCallbackABC
Basic version of DataCallbackABC.
Implemented to pass things through unchanged. Will be used for default construction
Methods:
check
(data)Perform any consistency checks between self and data.
deriv_args
(data, *, deriv_args)Adjust derivs args from data class.
resample
(data, *, meta_kws, sampler, **kws)Adjust create new object.
reduce
(data, *, meta_kws, **kws)Reduce along dimension.
asdict
()Convert object to dictionary.
assign
(**kws)Alias to
new_like()
.new_like
(**kws)Create a new object with optional parameters.
- resample(data, *, meta_kws, sampler, **kws)[source]#
Adjust create new object.
Should return new instance of class or self no change
- assign(**kws)[source]#
Alias to
new_like()
.
- class thermoextrap.data.DataCallbackABC[source]#
Bases:
MyAttrsMixin
Base class for handling callbacks to adjust data.
For some cases, the default Data classes don’t quite cut it. For example, for volume extrapolation, extrap parameters need to be included in the derivatives. To handle this generally, the Data class include self.meta which performs these actions.
DataCallback can be subclassed to fine tune things.
Methods:
check
(data)Perform any consistency checks between self and data.
deriv_args
(data, *, deriv_args)Adjust derivs args from data class.
resample
(data, *, meta_kws, sampler, **kws)Adjust create new object.
reduce
(data, *, meta_kws, **kws)Reduce along dimension.
asdict
()Convert object to dictionary.
assign
(**kws)Alias to
new_like()
.new_like
(**kws)Create a new object with optional parameters.
- abstractmethod deriv_args(data, *, deriv_args)[source]#
Adjust derivs args from data class.
should return a tuple
- resample(data, *, meta_kws, sampler, **kws)[source]#
Adjust create new object.
Should return new instance of class or self no change
- assign(**kws)[source]#
Alias to
new_like()
.
- class thermoextrap.data.DataCentralMoments(dxduave, *, meta=None, umom_dim='umom', deriv_dim=None, xmom_dim='xmom', rec_dim='rec', central=False, x_is_u=None, use_cache=True)[source]#
Bases:
DataCentralMomentsBase
[DataT
]Data class using
cmomy.CentralMomentsData
to handle central moments.- Parameters:
meta (
dict
, optional) – extra meta data/parameters to be carried along with object and child objects. if ‘checker’ in meta, then perform a callback of the form meta[‘checker](self, meta) this can also be used to override things like deriv_args. Values passed through method resample_metaumom_dim (
str
, default'umom'
) – Name of dimension for moment of energy u.deriv_dim (
str
, defaultNone
) – if deriv_dim is a string, then this is the name of the derivative dimension and xarray objects will have a derivativexmom_dim (
str
, default'xmom'
) – Name of dimension for moments of observable x.rec_dim (hashable) – Name of dimension for ‘records’, i.e., multiple observations.
central (
bool
) – If True, Use central moments. Otherwise, use raw moments.x_is_u (
bool
, defaultFalse
) – if True, treat xv = uv and do adjust u/du accordinglyuse_cache (
bool
) – IfTrue
(default), cache intermediate result. Speeds up calculations, but can lead to large objects.
Attributes:
Wrapped
cmomy.CentralMomentsData
object.Whether central or raw moments are used
Arguments to be passed to derivative function.
Derivative dimension
Averages of
du ** n
.Selector for
du_selector[n] = du ** n
.Averages of form
dx * dx ** n
.Selector for
dxdu_selector[n] = dx * du ** n
.Callback
Order of expansion.
Records dimension
Averages of form
u ** n
.Indexer for
u_selector[n] = u ** n
.Energy moments dimension
Data underlying
dxduave
.Whether observable x is same as energy u
Whether X has explicit dependence on alpha.
Averages of form observable
x
.Selector for
xave
.Overvable moment dimension
Averages of form
x * u ** n
.Indexer for
xu_select[n] = x * u ** n
.Methods:
reduce
([dim, axis, meta_kws])Reduce along axis.
resample
(sampler[, dim, axis, rep_dim, ...])Resample data.
from_raw
(raw[, rec_dim, xmom_dim, umom_dim, ...])Convert raw moments to data object.
from_vals
(uv, xv, order[, xmom_dim, ...])Create DataCentralMoments object from individual (unaveraged) samples.
from_data
(data[, rec_dim, xmom_dim, ...])Create DataCentralMoments object from data.
from_resample_vals
(xv, uv, order, sampler[, ...])Create DataCentralMoments object from unaveraged samples with resampling.
from_ave_raw
(u, xu[, weight, rec_dim, ...])Create object with <u**n>, <x * u**n> arrays.
from_ave_central
(du, dxdu[, weight, xave, ...])Constructor from central moments, with reduction along axis.
asdict
()Convert object to dictionary.
assign
(**kws)Alias to
new_like()
.cmom
()Central co-moments.
new_like
(**kws)Create a new object with optional parameters.
rmom
()Raw co-moments.
- property dxduave#
Wrapped
cmomy.CentralMomentsData
object.
- reduce(dim=MISSING, axis=MISSING, meta_kws=None, **kwargs)[source]#
Reduce along axis.
- Parameters:
dim (hashable) – Dimension to reduce/sample along.
axis (
int
) – Axis to reduce/sample along.meta_kws (mapping, optional) – Optional parameters for meta.
**kwargs – Keyword arguments to
cmomy.CentralMomentsData.reduce()
- resample(sampler, dim=MISSING, axis=MISSING, rep_dim='rep', parallel=None, meta_kws=None, **kwargs)[source]#
Resample data.
- Parameters:
sampler (
int
or array-like or mapping) – Passed throughcmomy.resample.factory_sampler()
to create anIndexSampler
. Value can either benrep
(the number of replicates),freq
(frequency array), aIndexSampler
object, or a mapping of parameters. The mapping can have form ofFactoryIndexSamplerKwargs
. Allowable keys arefreq
,indices
,ndat
,nrep
,nsamp
,paired
,rng
,replace
,shuffle
.dim (hashable) – Dimension to reduce/sample along.
axis (
int
) – Axis to reduce/sample along.rep_dim (hashable) – Name of new ‘replicated’ dimension:
parallel (
bool
, optional) – IfTrue
, use parallel numbanumba.njit
ornumba.guvectorized
code if possible. IfNone
, use a heuristic to determine if should attempt to use parallel method.meta_kws (mapping, optional) – Parameters to self.meta.resample
- classmethod from_raw(raw, rec_dim='rec', xmom_dim='xmom', umom_dim='umom', deriv_dim=None, central=False, x_is_u=False, meta=None, **kwargs)[source]#
Convert raw moments to data object.
The raw moments have the form
raw[..., i, j] = weight
ifi = j = 0
. Otherwise,raw[..., i, j] = <x ** i * u ** j>
.- Parameters:
raw (array-like) – raw moments. The form of this array is such that The shape should be
(..., 2, order+1)
rec_dim (hashable) – Name of dimension for ‘records’, i.e., multiple observations.
xmom_dim (
str
, default'xmom'
) – Name of dimension for moments of observable x.umom_dim (
str
, default'umom'
) – Name of dimension for moment of energy u.deriv_dim (
str
, defaultNone
) – if deriv_dim is a string, then this is the name of the derivative dimension and xarray objects will have a derivativecentral (
bool
) – If True, Use central moments. Otherwise, use raw moments.dims (hashable or sequence of hashable) – Dimension of resulting
xarray.DataArray
.If
len(dims) == self.ndim
, then dims specifies all dimensions.If
len(dims) == self.val_ndim
,dims = dims + mom_dims
Default to
('dim_0', 'dim_1', ...)
attrs (mapping) – Attributes of output
coords (mapping) – Coordinates of output
name (hashable) – Name of output
indexes (
Any
) – indexes attribute. This is ignored.template (
DataArray
) – If present, output will have attributes of template. Overrides other options.meta (
dict
, optional) – extra meta data/parameters to be carried along with object and child objects. if ‘checker’ in meta, then perform a callback of the form meta[‘checker](self, meta) this can also be used to override things like deriv_args. Values passed through method resample_metax_is_u (
bool
, defaultFalse
) – if True, treat xv = uv and do adjust u/du accordingly**kwargs – Extra arguments to
cmomy.wrap_raw()
- Returns:
output (
DataCentralMoments
)
See also
- classmethod from_vals(uv, xv, order, xmom_dim='xmom', umom_dim='umom', rec_dim='rec', deriv_dim=None, central=False, weight=None, axis=MISSING, dim=MISSING, meta=None, x_is_u=False, **kwargs)[source]#
Create DataCentralMoments object from individual (unaveraged) samples.
- Parameters:
xv (
xarray.DataArray
) – raw values of x (observable)uv (
xarray.DataArray
) – raw values of u (energy)order (
int
) – maximum order of moments/expansion to calculatexmom_dim (
str
, default'xmom'
) – Name of dimension for moments of observable x.umom_dim (
str
, default'umom'
) – Name of dimension for moment of energy u.rec_dim (hashable) – Name of dimension for ‘records’, i.e., multiple observations.
deriv_dim (
str
, defaultNone
) – if deriv_dim is a string, then this is the name of the derivative dimension and xarray objects will have a derivativecentral (
bool
) – If True, Use central moments. Otherwise, use raw moments.weight (array-like or
DataArray
, optional) – optional weight array. Note that this array/xarray must be conformable to uv, xvdim (hashable) – Dimension to reduce/sample along.
axis (
int
) – Axis to reduce/sample along.meta (
dict
, optional) – extra meta data/parameters to be carried along with object and child objects. if ‘checker’ in meta, then perform a callback of the form meta[‘checker](self, meta) this can also be used to override things like deriv_args. Values passed through method resample_metax_is_u (
bool
, defaultFalse
) – if True, treat xv = uv and do adjust u/du accordingly**kwargs – Extra arguments to
cmomy.wrap_reduce_vals()
- Returns:
output (
DataCentralMoments
)
See also
- classmethod from_data(data, rec_dim='rec', xmom_dim='xmom', umom_dim='umom', deriv_dim=None, central=False, meta=None, x_is_u=False, **kwargs)[source]#
Create DataCentralMoments object from data.
- data[…, i, j] = weight i = j = 0
= < x > i = 1 and j = 0 = < u > i = 0 and j = 1 = <(x - <x>)**i * (u - <u>)**j > otherwise
If pass in
x_is_u = True
, then treatdata
as a moments array for energy (i.e., usingumom_dim
). This is then converted to a comoments array usingcmomy.convert.moments_to_comoments()
.- Parameters:
data (
DataArray
)rec_dim (hashable) – Name of dimension for ‘records’, i.e., multiple observations.
xmom_dim (
str
, default'xmom'
) – Name of dimension for moments of observable x.umom_dim (
str
, default'umom'
) – Name of dimension for moment of energy u.deriv_dim (
str
, defaultNone
) – if deriv_dim is a string, then this is the name of the derivative dimension and xarray objects will have a derivativecentral (
bool
) – If True, Use central moments. Otherwise, use raw moments.meta (
dict
, optional) – extra meta data/parameters to be carried along with object and child objects. if ‘checker’ in meta, then perform a callback of the form meta[‘checker](self, meta) this can also be used to override things like deriv_args. Values passed through method resample_metax_is_u (
bool
, defaultFalse
) – if True, treat xv = uv and do adjust u/du accordingly**kwargs – Extra arguments to
cmomy.wrap()
- Returns:
output (
DataCentralMoments
)
See also
- classmethod from_resample_vals(xv, uv, order, sampler, weight=None, axis=MISSING, dim=MISSING, xmom_dim='xmom', umom_dim='umom', rep_dim='rep', deriv_dim=None, central=False, meta=None, meta_kws=None, x_is_u=False, parallel=None, **kwargs)[source]#
Create DataCentralMoments object from unaveraged samples with resampling.
- Parameters:
xv (
xarray.DataArray
) – raw values of x (observable)uv (
xarray.DataArray
) – raw values of u (energy)order (
int
) – maximum order of moments/expansion to calculateweight (array-like or
DataArray
, optional) – optional weight array. Note that this array/xarray must be conformable to uv, xvaxis (
int
) – Axis to reduce/sample along.dim (hashable) – Dimension to reduce/sample along.
xmom_dim (
str
, default'xmom'
) – Name of dimension for moments of observable x.umom_dim (
str
, default'umom'
) – Name of dimension for moment of energy u.rep_dim (hashable) – Name of new ‘replicated’ dimension:
deriv_dim (
str
, defaultNone
) – if deriv_dim is a string, then this is the name of the derivative dimension and xarray objects will have a derivativecentral (
bool
) – If True, Use central moments. Otherwise, use raw moments.meta (
dict
, optional) – extra meta data/parameters to be carried along with object and child objects. if ‘checker’ in meta, then perform a callback of the form meta[‘checker](self, meta) this can also be used to override things like deriv_args. Values passed through method resample_metameta_kws (mapping, optional) – Optional parameters for meta.
x_is_u (
bool
, defaultFalse
) – if True, treat xv = uv and do adjust u/du accordingly**kwargs – Extra arguments to
cmomy.wrap_resample_vals()
- classmethod from_ave_raw(u, xu, weight=None, rec_dim='rec', xmom_dim='xmom', umom_dim='umom', deriv_dim=None, central=False, meta=None, x_is_u=False)[source]#
Create object with <u**n>, <x * u**n> arrays.
- Parameters:
u (array-like) – u[n] = <u**n>.
xu (array_like) – xu[n] = <x * u**n>.
weight (array-like, optional) – sample weights
rec_dim (hashable) – Name of dimension for ‘records’, i.e., multiple observations.
xmom_dim (
str
, default'xmom'
) – Name of dimension for moments of observable x.umom_dim (
str
, default'umom'
) – Name of dimension for moment of energy u.deriv_dim (
str
, defaultNone
) – if deriv_dim is a string, then this is the name of the derivative dimension and xarray objects will have a derivativecentral (
bool
) – If True, Use central moments. Otherwise, use raw moments.mom (
int
ortuple
ofint
) – Order or moments. If integer or length one tuple, then moments are for a single variable. If length 2 tuple, then comoments of two variablesdims (hashable or sequence of hashable) – Dimension of resulting
xarray.DataArray
.If
len(dims) == self.ndim
, then dims specifies all dimensions.If
len(dims) == self.val_ndim
,dims = dims + mom_dims
Default to
('dim_0', 'dim_1', ...)
attrs (mapping) – Attributes of output
coords (mapping) – Coordinates of output
name (hashable) – Name of output
indexes (
Any
) – indexes attribute. This is ignored.template (
DataArray
) – If present, output will have attributes of template. Overrides other options.meta (
dict
, optional) – extra meta data/parameters to be carried along with object and child objects. if ‘checker’ in meta, then perform a callback of the form meta[‘checker](self, meta) this can also be used to override things like deriv_args. Values passed through method resample_metax_is_u (
bool
, defaultFalse
) – if True, treat xv = uv and do adjust u/du accordingly
See also
- classmethod from_ave_central(du, dxdu, weight=None, xave=None, uave=None, rec_dim='rec', xmom_dim='xmom', umom_dim='umom', deriv_dim=None, central=False, meta=None, x_is_u=False)[source]#
Constructor from central moments, with reduction along axis.
- Parameters:
du (array-like) – du[0] = 1 or weight, du[1] = <u> or uave du[n] = <(u-<u>)**n>, n >= 2
dxdu (array-like) – dxdu[0] = <x> or xave, dxdu[n] = <(x-<x>) * (u - <u>)**n>, n >= 1
weight (array-like, optional) – sample weights
xave (array-like, optional) – if present, set dxdu[0] to xave
uave (array-like, optional) – if present, set du[0] to uave
rec_dim (hashable) – Name of dimension for ‘records’, i.e., multiple observations.
xmom_dim (
str
, default'xmom'
) – Name of dimension for moments of observable x.umom_dim (
str
, default'umom'
) – Name of dimension for moment of energy u.deriv_dim (
str
, defaultNone
) – if deriv_dim is a string, then this is the name of the derivative dimension and xarray objects will have a derivativecentral (
bool
) – If True, Use central moments. Otherwise, use raw moments.mom (
int
ortuple
ofint
) – Order or moments. If integer or length one tuple, then moments are for a single variable. If length 2 tuple, then comoments of two variablesmeta (
dict
, optional) – extra meta data/parameters to be carried along with object and child objects. if ‘checker’ in meta, then perform a callback of the form meta[‘checker](self, meta) this can also be used to override things like deriv_args. Values passed through method resample_metax_is_u (
bool
, defaultFalse
) – if True, treat xv = uv and do adjust u/du accordingly
See also
- assign(**kws)[source]#
Alias to
new_like()
.
- central#
Whether central or raw moments are used
- property deriv_args#
Arguments to be passed to derivative function.
For example,
derivs(*self.deriv_args)
.
- deriv_dim#
Derivative dimension
- meta#
Callback
- new_like(**kws)[source]#
Create a new object with optional parameters.
- Parameters:
**kws – attribute, value pairs.
- property order#
Order of expansion.
- rec_dim#
Records dimension
- umom_dim#
Energy moments dimension
- x_is_u#
Whether observable x is same as energy u
- property xalpha#
Whether X has explicit dependence on alpha.
That is, if self.deriv_dim is not None
- xmom_dim#
Overvable moment dimension
- class thermoextrap.data.DataCentralMomentsVals(uv, xv, resample_values=False, *, meta=None, umom_dim='umom', deriv_dim=None, xmom_dim='xmom', rec_dim='rec', central=False, x_is_u=None, use_cache=True, order=None, weight=None, from_vals_kws=NOTHING, dxduave=None)[source]#
Bases:
DataCentralMomentsBase
[DataT
]Data object based on central co-moments array.
- Parameters:
meta (
dict
, optional) – extra meta data/parameters to be carried along with object and child objects. if ‘checker’ in meta, then perform a callback of the form meta[‘checker](self, meta) this can also be used to override things like deriv_args. Values passed through method resample_metaumom_dim (
str
, default'umom'
) – Name of dimension for moment of energy u.deriv_dim (
str
, defaultNone
) – if deriv_dim is a string, then this is the name of the derivative dimension and xarray objects will have a derivativexmom_dim (
str
, default'xmom'
) – Name of dimension for moments of observable x.rec_dim (hashable) – Name of dimension for ‘records’, i.e., multiple observations.
central (
bool
) – If True, Use central moments. Otherwise, use raw moments.x_is_u (
bool
, defaultFalse
) – if True, treat xv = uv and do adjust u/du accordinglyuse_cache (
bool
) – IfTrue
(default), cache intermediate result. Speeds up calculations, but can lead to large objects.
Attributes:
Stored energy values
Stored observable values
Stored weights
Optional parameters to
cmomy.wrap_reduce_vals()
If
True
, resampleuv
andxv
.Wrapped
cmomy.CentralMomentsData
object.Order of expansion.
Whether central or raw moments are used
Arguments to be passed to derivative function.
Derivative dimension
Averages of
du ** n
.Selector for
du_selector[n] = du ** n
.Averages of form
dx * dx ** n
.Selector for
dxdu_selector[n] = dx * du ** n
.Callback
Records dimension
Averages of form
u ** n
.Indexer for
u_selector[n] = u ** n
.Energy moments dimension
Data underlying
dxduave
.Whether observable x is same as energy u
Whether X has explicit dependence on alpha.
Averages of form observable
x
.Selector for
xave
.Overvable moment dimension
Averages of form
x * u ** n
.Indexer for
xu_select[n] = x * u ** n
.Methods:
from_vals
(xv, uv, order[, weight, rec_dim, ...])Constructor from arrays.
resample
(sampler[, dim, axis, rep_dim, ...])Resample data.
asdict
()Convert object to dictionary.
assign
(**kws)Alias to
new_like()
.cmom
()Central co-moments.
new_like
(**kws)Create a new object with optional parameters.
rmom
()Raw co-moments.
- uv#
Stored energy values
- xv#
Stored observable values
- weight#
Stored weights
- from_vals_kws#
Optional parameters to
cmomy.wrap_reduce_vals()
- resample_values#
If
True
, resampleuv
andxv
. Otherwise resample during construction ofdxduave
.
- property dxduave#
Wrapped
cmomy.CentralMomentsData
object.
- property order#
Order of expansion.
- classmethod from_vals(xv, uv, order, weight=None, rec_dim='rec', umom_dim='umom', xmom_dim='xmom', deriv_dim=None, central=False, from_vals_kws=None, resample_values=False, meta=None, x_is_u=False)[source]#
Constructor from arrays.
- Parameters:
xv (
xarray.DataArray
) – raw values of x (observable)uv (
xarray.DataArray
) – raw values of u (energy)order (
int
) – maximum order of moments/expansion to calculatexmom_dim (
str
, default'xmom'
) – Name of dimension for moments of observable x.umom_dim (
str
, default'umom'
) – Name of dimension for moment of energy u.rec_dim (hashable) – Name of dimension for ‘records’, i.e., multiple observations.
deriv_dim (
str
, defaultNone
) – if deriv_dim is a string, then this is the name of the derivative dimension and xarray objects will have a derivativecentral (
bool
) – If True, Use central moments. Otherwise, use raw moments.weight (array-like or
DataArray
, optional) – optional weight array. Note that this array/xarray must be conformable to uv, xvval_shape (
tuple
) – Shape of values part of data. That is, the non-moment dimensions.dims (hashable or sequence of hashable) – Dimension of resulting
xarray.DataArray
.If
len(dims) == self.ndim
, then dims specifies all dimensions.If
len(dims) == self.val_ndim
,dims = dims + mom_dims
Default to
('dim_0', 'dim_1', ...)
attrs (mapping) – Attributes of output
coords (mapping) – Coordinates of output
name (hashable) – Name of output
indexes (
Any
) – indexes attribute. This is ignored.template (
DataArray
) – If present, output will have attributes of template. Overrides other options.meta (
dict
, optional) – extra meta data/parameters to be carried along with object and child objects. if ‘checker’ in meta, then perform a callback of the form meta[‘checker](self, meta) this can also be used to override things like deriv_args. Values passed through method resample_metax_is_u (
bool
, defaultFalse
) – if True, treat xv = uv and do adjust u/du accordingly
- Returns:
output (
DataCentralMomentsVals
)
See also
- resample(sampler, dim=MISSING, axis=MISSING, rep_dim='rep', parallel=None, meta_kws=None, resample_values=None, **kwargs)[source]#
Resample data.
- Parameters:
sampler (
int
or array-like or mapping) – Passed throughcmomy.resample.factory_sampler()
to create anIndexSampler
. Value can either benrep
(the number of replicates),freq
(frequency array), aIndexSampler
object, or a mapping of parameters. The mapping can have form ofFactoryIndexSamplerKwargs
. Allowable keys arefreq
,indices
,ndat
,nrep
,nsamp
,paired
,rng
,replace
,shuffle
.dim (hashable) – Dimension to reduce/sample along.
axis (
int
) – Axis to reduce/sample along.rep_dim (hashable) – Name of new ‘replicated’ dimension:
parallel (
bool
, optional) – IfTrue
, use parallel numbanumba.njit
ornumba.guvectorized
code if possible. IfNone
, use a heuristic to determine if should attempt to use parallel method.meta_kws (mapping, optional) – Optional parameters for meta.
resample_values (
bool
) – IfTrue
, resamplexv
anduv
. IfFalse
, resampledxduave
(seecmomy.wrap_resample_vals()
) and leavexv
anduv
unchanged.**kwargs – Keyword arguments to
cmomy.wrap_resample_vals()
See also
Notes
resample_values
defaults toself.resample_values
.
- assign(**kws)[source]#
Alias to
new_like()
.
- central#
Whether central or raw moments are used
- property deriv_args#
Arguments to be passed to derivative function.
For example,
derivs(*self.deriv_args)
.
- deriv_dim#
Derivative dimension
- meta#
Callback
- new_like(**kws)[source]#
Create a new object with optional parameters.
- Parameters:
**kws – attribute, value pairs.
- rec_dim#
Records dimension
- umom_dim#
Energy moments dimension
- x_is_u#
Whether observable x is same as energy u
- property xalpha#
Whether X has explicit dependence on alpha.
That is, if self.deriv_dim is not None
- xmom_dim#
Overvable moment dimension
- thermoextrap.data.factory_data_values(uv, xv, *, order, central=False, xalpha=False, rec_dim='rec', umom_dim='umom', xmom_dim='xmom', val_dims='val', rep_dim='rep', deriv_dim=None, x_is_u=False, resample_values=True, **kws)[source]#
Factory function to produce a DataCentralMomentsVals object.
- Parameters:
order (
int
) – Highest moment <x * u ** order>. For the case x_is_u, highest order is <u ** (order+1)>uv (array-like) – raw values of u (energy) if not DataArray, wrap with xrwrap_uv
xv (
xarray.DataArray
) – raw values of x (observable) if not DataArray, wrap with xrwrap_xvcentral (
bool
) – If True, Use central moments. Otherwise, use raw moments.xalpha (
bool
, defaultFalse
) – Flag whether u depends on variable alpha.rec_dim (hashable) – Name of dimension for ‘records’, i.e., multiple observations.
umom_dim (
str
, default'umom'
) – Name of dimension for moment of energy u.val_dims (
str
or sequence ofstr
) – Names of extra dimensionsrep_dim (hashable) – Name of new ‘replicated’ dimension:
deriv_dim (
str
, defaultNone
) – if deriv_dim is a string, then this is the name of the derivative dimension and xarray objects will have a derivativex_is_u (
bool
, defaultFalse
) – if True, treat xv = uv and do adjust u/du accordinglyresample_values (
bool
) – IfTrue
, resamplexv
anduv
. IfFalse
, resampledxduave
(seecmomy.wrap_resample_vals()
) and leavexv
anduv
unchanged.**kws – Extra arguments passed to constructor
- Returns:
output (
DataCentralMomentsVals
)
See also