Skip to main content

Central (co)moment calculation/manipulation

Project description

cmomy

Central (co)moment calculation/manipulation

  • Free software: NIST license

Overview

cmomy is an open source package to calculate central moments and co-moments in a numerical stable and direct way. Behind the scenes, cmomy makes use of Numba to rapidly calculate moments. A good introduction to the type of formulas used can be found here.

Features

  • Fast calculation of central moments and central co-moments with weights

  • Support for scalor or vector inputs

  • numpy and xarray api’s

Installation

Use one of the following

pip install cmomy
conda install -c wpk-nist cmomy

Basic Usage

For a quick introduction to the usage of cmomy, please see the basic usage

Note on caching

This code makes extensive use of the numba python package. This uses a jit compiler to speed up vital code sections. This means that the first time a funciton called, it has to compile the underlying code. However, caching has been implemented. Therefore, the very first time you run a function, it may be slow. But all subsequent uses (including other sessions) will be already compiled.

Testing

Tests are packaged with the distribution intentionally. To test code run:

pytest --pyargs cmomy

By running the tests once, you create a cache of the numba code for most cases. The first time you run the tests, it will take a while (about 1.5 min on my machine). However, subsequent runs will be much faster (about 3 seconds on my machine).

Credits

This package was created with Cookiecutter and the wpk-nist-gov/cookiecutter-pypackage Project template forked from audreyr/cookiecutter-pypackage.

History

0.0.5 (2020-12-30)

  • First release on PyPI.

This software was developed by employees of the National Institute of Standards and Technology (NIST), an agency of the Federal Government. Pursuant to title 17 United States Code Section 105, works of NIST employees are not subject to copyright protection in the United States and are considered to be in the public domain. Permission to freely use, copy, modify, and distribute this software and its documentation without fee is hereby granted, provided that this notice and disclaimer of warranty appears in all copies.

THE SOFTWARE IS PROVIDED ‘AS IS’ WITHOUT ANY WARRANTY OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND FREEDOM FROM INFRINGEMENT, AND ANY WARRANTY THAT THE DOCUMENTATION WILL CONFORM TO THE SOFTWARE, OR ANY WARRANTY THAT THE SOFTWARE WILL BE ERROR FREE. IN NO EVENT SHALL NIST BE LIABLE FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM, OR IN ANY WAY CONNECTED WITH THIS SOFTWARE, WHETHER OR NOT BASED UPON WARRANTY, CONTRACT, TORT, OR OTHERWISE, WHETHER OR NOT INJURY WAS SUSTAINED BY PERSONS OR PROPERTY OR OTHERWISE, AND WHETHER OR NOT LOSS WAS SUSTAINED FROM, OR AROSE OUT OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR SERVICES PROVIDED HEREUNDER.

Distributions of NIST software should also include copyright and licensing statements of any third-party software that are legally bundled with the code in compliance with the conditions of those licenses.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cmomy-0.1.0.tar.gz (133.4 kB view hashes)

Uploaded Source

Built Distribution

cmomy-0.1.0-py3-none-any.whl (64.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page