Math-related utility functions.

python, math, array, metric, function, segment
pip install comath==0.0.7



PyPI-Status PyPI-Versions Build-Status Codecov LICENCE

A small pure-python package for math-related utility functions.

>>> from comath.array import percentile
>>> percentile([4,6,8,9,11], 0.4)

1   Installation

Install comath with:

pip install comath

2   Use

comath is divided into four sub-modules.

2.1   array

Array operations like percentile and median.

2.2   func

Utility function like a smooth step function and closest larger power of 2.

2.3   metric

Computing moving metrics (moving average, precision and variance).

2.4   segment

Defines a one-dimensional line segment.

3   Contributing

Package author and current maintainer is Shay Palachy (; You are more than welcome to approach him for help. Contributions are very welcomed.

3.1   Installing for development


git clone

Install in development mode with test dependencies:

cd comath
pip install -e ".[test]"

3.2   Running the tests

To run the tests, use:

python -m pytest --cov=comath --doctest-modules

3.3   Adding documentation

This project is documented using the numpy docstring conventions, which were chosen as they are perhaps the most widely-spread conventions that are both supported by common tools such as Sphinx and result in human-readable docstrings (in my personal opinion, of course). When documenting code you add to this project, please follow these conventions.

4   Credits

Created by Shay Palachy (