Changelog#
Changelog for cmomy
Unreleased#
See the fragment files in changelog.d
v1.0.2 — 2025-10-14#
Changed#
Using
uv_buildbackendRemoved typing import cycles. This required adding
cmomy.resample.typingandcmomy.wrapper.typing.cmomy.core.typing.Sampler->cmomy.resample.typing.SamplerTypecmomy.core.typing.MomParamsInput->cmomy.core.mom_params.MomParamsType
v1.0.1 — 2025-09-26#
Changed#
Default to
axes_to_end=Falsein all cases.
v1.0.0 — 2025-09-26#
Added#
Added
reduce_vals_groupedandreduce_vals_indexedto create grouped central moments from values.Added better typing fallbacks for unions of array-like or xarray objects.
Value reduction (
reduce_valsresample_vals, etc) now supportmom_axesparameter. This allowsmom_axesto be placed where you like, with output in proper orderFully support output order (e.g.,
order="C") for xarray objects, including reorderingmom_axesof value reduction (reduce_vals, etc) forDataArrayobjects.Added
coords_policytoreduce_data/vals_grouped.Added
coords_policysupport toDatasetobjects.Added testing coverage to default python version.
Changed#
Bug fix to numba decorator
Update
cmomy.core.prepareRework
cmomy.core.moment_paramsto better handle subclassingProgrammatic import in
cmomy.factorymoduleUse
__init__.pyiwithlazy_loader.Cleanup core calculation in
_reduce_data
v0.24.0 — 2025-01-23#
Added#
Python version 3.13 now supported.
Changed#
Moved grouped/indexed routines (e.g.,
reduce_data_indexed,factor_by, etc) tocmomy.groupedsubmodule. Main functions are still available at top level (cmomy.reduce_data_groupediscmomy.grouped.reduce_data_grouped).
v0.23.0 — 2024-10-30#
Changed#
Routines now accept
mom_axesparameter. This allows for moment axes to be in arbitrary locationRoutines now accept
mom_paramsparameter. This object contains all the logic for working with moment arrays. This Also simplifies calling routines from other classes/routines.Update requirements, typing, and linting
Routines now correctly respect the
orderparameter. Passing inNonewill lead to arrays that arecordered when “normalized” (i.e., which haveaxisandmom_axesat the end), which is the default behavior ofnumb.guvectorize. Passing ordercwill lead to outputs that arecordered regardless ofmom_axeslocation.Negative axis/axes are now treated relative to the end of the array (just like python lists and numpy ndarray objects). To get the old behavior of counting relative to the
mom_ndim, pass in imaginary axis. For example, passingaxis=-1jwithmom_ndim=1is equivalent to passingaxis=-2.renamed parameter
move_axes_to_endtoaxes_to_end. This will lead to axes being in the form(..., *mom_axes)ifaxesare reduced or(..., *axes, *mom_axes)ifaxesare kept.Applying routines to
datasetobjects now keeps correct order ifaxes_to_endisFalse.
v0.22.0 — 2024-09-28#
Changed#
For xarray (DataArray and Dataset) central moments data, routines will infer
mom_ndimfrommom_dims. For example, can callingcmomy.reduce_data(data, mom_dims=("mom_0", "mom_1"), dim="a")will infermom_ndim=1.
v0.21.0 — 2024-09-25#
Removed#
cmomy.randsamp_freqhas been replaced withcmomy.factory_sampler
Added#
cmomy.factory_samplerto create a sampler for resample routines.cmomy.IndexSamplerto wrap resample “indices” and “freq” table.
Changed#
Added
IndexSamplerclass to handle resampling. This wraps either resamplingindicesor a “frequency” tablefreq, and can produce whichever is not provided.replace
randsamp_freqwithfactory_samplerwhich createsIndexSamplerfrom parameters or a mapping.Removed arguments
freq,nrep,rng,pairedfrom resampling routines (resample_data, etc). This was replaced by an argumentssamplerwhich can be either anIndexSampleror a mapping which is passed tofactory_sampler. This means that to call the resampling routines, you’ll have to pass a sampler or a dict of parameters. While this is a little annoying, it greatly cleans up a bunch of parameters that may not be used. For example, the callcmomy.resample_data(data, axis=0, nrep=10, rng=0)is nowcmomy.resampler_data(data, axis=0, sampler={"nrep": 10, "rng": 0}). Plus, you can now passindiceswithcmomy.resample_data(data, axis=0, sampler={"indices": indices})Removed parameter
on_missing_core_dimfrom routines that callxarray.apply_ufuncbehind the scenes. You can still pass this parameter usingapply_ufunc_kwargs. For example,cmomy.reduce_data(data, axis=0, apply_ufunc_kwargs={"on_missing_core_dim": "drop"}).
v0.20.0 — 2024-09-21#
Fixed#
Made
cmomy.resample.freq_to_indicesandcmomy.resample.indices_to_freqgufunc’s. Much faster than old code (freq_to_indiceswas a bottleneck).
v0.19.0 — 2024-09-20#
Added#
Added
cmomy.convert.comoments_to_momentsroutine, which is the inverse ofcmomy.convert.moments_to_comoments.
v0.18.0 — 2024-09-18#
Added#
cmomy.assign_momentandcmomy.select_momentnow accept optionsxmom_0,xmom_1,ymom_0, andymom_1. These allow selecting/assigning to slices. Useful when converting values to central moments array.
v0.17.0 — 2024-09-16#
Added#
Now fully support wrapping
xarray.DatasetobjectsComplete rewrite of wrapper classes
Added
wrapperfactory methodscmomy.wrap,cmomy.wrap_reduce_vals, etc. These automatically select fromCentralMomentsArrayandCentralMomentsData.Renamed
CentralMomentstoCentralMomentsArrayandxCentralMomentstoCentralMomentsData. The former is parameterized across numpy arrays. The later is parameterized to work with eitherxarray.DataArrayorxarray.DatasetobjectsFull support
daskbackedxarrayobjects. This will be lazily evaluated.Removed
CentralMomentsArray/Data.blockmethod. Instead, there is ablockkeyword inreducemethod.to_dataarray,to_dataset, etc, method ofCentralMomentsArray/Datanow return a wrapped object instead of anxarrayobject. To access the underlyingxarrayobject, use theobjattribute.Removed
valuesanddataattributes fromCentralMomentsArray/Datawrapper classes. Now wrap either an array orxarrayobject directly (instead of only really wrappingnumpyarrays in the old code). To access the wrapped object, now useobjattribute.Now include testing of typing (
mypyandpyright) support.
v0.16.0 — 2024-08-06#
Added#
Added
rollingmodule for rolling mean and exponential rolling mean.Added
bootstrap_confidence_intervalmethod to calculate confidence intervalsAdded
moveaxisfunction to cleanly handle axes movement of central moments arrayAdded
select_momentmethod to select specific moments (weight, average, etc) from a central moments arrayAdded
assign_momentmethod to assign values to specific moments.Added
vals_to_datato simplify using_datamethods for raw values.Added
jackknife_an routines to perform jackknife analysis.Update
_valsroutines to properly place theaxisparameter in result.Added
axes_to_endoption to most routines.Added
keepdimsoption fromreduce_dataandreduce_vals
v0.15.0 — 2024-06-21#
Added#
Added
cmomy.concatmethod to concatenate moments objects.Added
__getitem__to(x)CentralMomentsobjects. This method does not* allow changing the moments shape. If you want to do that, you’ll need to work directly with(x)CentralMoments.to_values()
v0.14.0 — 2024-06-20#
Added#
added
cmomy.resample.select_ndatto select data size along reduction dimensionAdded
cmomy.randsamp_freqto top level api
Changed#
Updated
cmomy.resample.randsamp_freqto select ndat from array
v0.13.0 — 2024-06-18#
Added#
Added
cmomy.convert.moments_to_comoments(and(x)CentralMoments.moments_to_comoments)to convert from single variable moments to comoments. This is useful inthermoextrap.Added
cmomy.convert.assign_weight(and(x)CentralMoments.assign_weights) to update weights (useful inthermoextrap).Added support for
numpy>=2.0.0. Because we still support older versions, we still use the old convention for thecopyparameter tonumpy.array. Will change this when minimum numpy is 2.0.
Changed#
Renamed
cmomy.convertfunction tocmomy.convert.moments_typeA bullet item for the Changed category.
v0.12.0 — 2024-06-13#
Added#
Now supports python3.12
v0.11.0 — 2024-06-12#
Changed#
Switch to underlying numba functions using
guvectorize. This significantly simplifies the code. Previously, we had separate functions for “vector” vs “scalar” moments. To handle arbitrary vector dimensions, the arrays were reshaped behind the scenes (to a single “meta” dimension). Now, this is all handled by thegufuncbased library code.Typing support improved.
Added
(x)CentralMoments.astypeAdded
(x)CentralMoments.Added alias
CentralMoments.to_xwhich is the same asCentralMoments.to_xcentralmoments.Added alias
xCentralMoments.to_cwhich is the same asxCentralMoments.to_centralmoments.Most constructors now accept
orderanddtypearguments.Most routines that process central moments accept a
parallelparameter.Instead of complicated internal validation routines in
(x)CentralMoments, most of this is now handled bycmomy.reductionor similar routines.Now using
xr.apply_ufuncfor most of thexarray.DataArraybased calculations.
Deprecated#
Removed classmethod
(x)CentralMoments.from_raws. Instead, use(x)CentralMoments.from_raw(...).reduce(...).Removed classmethod
(x)CentralMoments.from_datas. Instead, use(x)CentralMoments.from_data(...).reduce(...).Removed classmethod
(x)CentralMoments.from_data. Instead, use(x)CentralMoments(....).Removed ability to create
xCentralMomentsobjects directly fromnumpy.ndarrayobjects. (e.g., passing in array-like toxCentralmoments.from_valsdoes not work anymore). Instead useCentralMoments.from_vals(....).to_xcentralmoments(...), etc.Removed methods
push_stat,push_stats,from_stat,from_stats. Instead use, for example,numpy.concatenate, to combine weights, average, and variance into adataarray. A helper function may be added if called for.(x)CentralMoments.resample_and_reduceand(x)CentralMoments.from_resample_valsno longer acceptnrep=...orindices=.... They only acceptfreq=....
v0.9.0 — 2024-04-10#
Changed#
Can now resample with an arbitrary number of samples. Previously, it was assumed that resampling should be done with a shape
(nrep, ndat), wherenrepis the number of replicates andndatis the shape of the data along the resampled axis. Now you can pass sample with shape(nrep, nsamp)wherensampis the specified number of samples in a replicate (defaulting tondat). This allows users to do things like jackknife resampling, etc, withresample_and_reducemethods.Preliminary support for using type hints in generated documentation. The standard sphinx autodoc support does not quite work for
cmomy, as it requires type hints to be accessible at run time, and not inTYPE_CHECKINGblocks. Instead, we usesphinx_autodoc_type. This has the downside of expanding type aliases, but handles (most things) being inTYPE_CHECKINGblocks. Over time, we’ll replace some of the explicit parameter type documentation with those from type hints.Fixed creation of templates in reduction routines of
xCentralMoments. Previously, we build the template for the result using something likeda.isel(dim=0). This kept scalar coordinates ofdawithdim. Now we useda.isel(dim=0, drop=True)to drop these.Updated dependencies.
v0.8.0 — 2024-02-20#
Added#
Added
to_valuesmethod to access underlying array data. This should be preferred to.valuesattribute.Added
to_numpymethod to access underlyingnumpy.ndarray.Added
to_dataarraymethod to access underlyingxarray.DataArrayinxCentralMoment sAdded submodule
cmomy.randomto handle random numbers generation. This usesnumpy.random.Generatorbehind the scenes.Updated
rufflinting rulesNow using
hatchlingfor package buildingUpdate repo template
Changed#
Now CentralMoments and xCentralMoments ensure that data/data_flat share memory. This may result in passed data not being the same as the internal data, if reshaping data creates a copy.
Made little used arguments keyword only
v0.7.0 — 2023-08-11#
Added#
Now use lazy_loader to speed up initial load time.
Now using
module_utilities >=0.6.Changed from
custom-inherittodocstring-inheritanceNow fully supports typing (passing mypy –strict and pyright)
Relocated numba functions to submodule
cmomy._lib.
Changed#
Moved tests to top level of repo (
src/cmomy/teststotests)
v0.5.0 — 2023-06-14#
Added#
Package now available on conda-forge
Bumped maximum python version to 3.11
Changed#
Testing now handled with nox.
v0.4.0 — 2023-05-02#
Added#
Moved module
_docstrings_todocstrings. This can be used by other modules.
Changed#
Update package layout
New linters via pre-commit
Development env now handled by tox
Now use
module-utilitiesto handle caching and docfiller.
v0.3.0 - 2023-04-24#
Full set of changes:
v0.2.2...v0.3.0
v0.2.2 - 2023-04-05#
Full set of changes:
v0.2.1...v0.2.2
v0.2.1 - 2023-04-05#
Full set of changes:
v0.2.0...v0.2.1
v0.2.0 - 2023-03-22#
Full set of changes:
v0.1.9...v0.2.0
v0.1.9 - 2023-02-15#
Full set of changes:
v0.1.8...v0.1.9
v0.1.8 - 2022-12-02#
Full set of changes:
v0.1.7...v0.1.8
v0.1.7 - 2022-09-28#
Full set of changes:
v0.1.6...v0.1.7
v0.1.6 - 2022-09-27#
Full set of changes:
v0.1.5...v0.1.6
v0.1.5 - 2022-09-26#
Full set of changes:
v0.1.4...v0.1.5
v0.1.4 - 2022-09-15#
Full set of changes:
v0.1.3...v0.1.4
v0.1.3 - 2022-09-15#
Full set of changes:
v0.1.2...v0.1.3
v0.1.2 - 2022-09-13#
Full set of changes:
v0.1.1...v0.1.2
v0.1.1 - 2022-09-13#
Full set of changes:
v0.1.0...v0.1.1
v0.1.0 - 2022-09-13#
Full set of changes:
v0.0.7...v0.1.0
v0.0.7 - 2021-05-18#
Full set of changes:
v0.0.6...v0.0.7
v0.0.6 - 2021-02-03#
Full set of changes:
v0.0.4...v0.0.6
v0.0.4 - 2020-12-21#
Full set of changes:
v0.0.3...v0.0.4