Skip to main content

Collection math-related utilities developed at Body Labs

Project description

version python versions build status

Collection of math-related utilities developed at Body Labs.

This is a legacy library in active maintenance. The goals are:

  • Keep the library working in current versions of Python and other tools.

  • Make bug fixes.

  • Provide API stability and backward compatibility with the upstream version.

The main thrust is to transition the functionality in this library (and the code which depends on it, such as lace to new libraries include vg and polliwog. In general, new functionality should be added in the new libraries. As needed, additional libraries can be added to the lace org.

Installation

Install dependencies

On macOS:

brew install homebrew/science/suite-sparse
brew install homebrew/science/opencv --without-numpy

On Linux:

sudo apt-get install python-opencv libsuitesparse-dev

Install the library

pip install blmath

And import it just like the upstream library:

from blmath.numerics import vx

A collection of math related utilities used by many bits of BodyLabs’ code.

blmath.numerics

Functions for manipulating numeric arrays, numbers, and linear algebra.

The most commonly used of these are directly imported into blmath.numerics.

  • blmath.numerics.vx is a namespace of common linear algebra operations. These are easily expressed in numpy, but abstracted for readability purposes.

  • blmath.numerics.coercion contains a validation function as_numeric_array, which produces useful error messages up front on bad inputs, in place of cryptic messages like “cannot broadcast…” later on.

  • blmath.numerics.operations contains basic numerical operations such as zero_safe_divide.

  • blmath.numerics.predicates contains functions like isnumeric.

  • blmath.numerics.rounding contains functions including “round to nearest” and roundedlist.

  • blmath.numerics.numpy_ext contains numpy utility functions.

  • blmath.numerics.matlab contains some matlab shortcuts which have no numpy equivalent. At MPI the fitting code was originally written in Matlab before it was ported to Python.

blmath.numerics.linalg contains linear algebra operations.

blmath.geometry

Geometric operations, transforms, and primitives, in 2D and 3D.

The most commonly used of these are directly imported into blmath.geometry.

blmath.geometry.transform includes code for 3D transforms.

Other modules:

blmath.value

Class for wrapping and manipulating value/units pairs.

blmath.units

TODO write something here

blmath.console

Development

pip install -r requirements_dev.txt
pip install -e .  # builds the native extension
rake unittest
rake lint

Contribute

Pull requests welcome!

Support

If you are having issues, please let us know.

Acknowledgements

This collection was developed at Body Labs and includes a combination of code developed at Body Labs, from legacy code and significant new portions by Eric Rachlin, Alex Weiss, and Paul Melnikow. It was extracted from the Body Labs codebase and open-sourced by Alex Weiss. In 2018 it was forked by Paul Melnikow and published as metablmath. Thanks to a repository and package transfer from Body Labs, the fork has been merged back into the original.

License

The project is licensed under the two-clause BSD license.

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

blmath-1.6.2.tar.gz (57.7 kB view details)

Uploaded Source

File details

Details for the file blmath-1.6.2.tar.gz.

File metadata

  • Download URL: blmath-1.6.2.tar.gz
  • Upload date:
  • Size: 57.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.9.1 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.16

File hashes

Hashes for blmath-1.6.2.tar.gz
Algorithm Hash digest
SHA256 01a2ee5286af42c8a86cc6b475f884341cbfa52536266b15efc96e46dc230a77
MD5 5f703943ad24d8eb015cd9334efc7bca
BLAKE2b-256 a442a2c4f7416857cecd69dde0f336f04179809ace41cf400515da43603a39a5

See more details on using hashes here.

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