Skip to content

Simple and flexible n-vector implementation in Numpy

License

Notifications You must be signed in to change notification settings

gwerbin/nvector-lite

Repository files navigation

N-vector Lite

About

N-vector Lite is a simple, flexible, and permissively-licensed implementation of the "n-vector" horizontal position system in Python and Numpy. It is currently alpha quality.

Note that this project is developed/maintained as a side project in my spare time. See LICENSE.txt for license terms, including a total disclaimer of warranty. Contributions of bugfixes and features are accepted, but I make no promises about the timeliness of my response.

For an explanation of the n-vector system, refer to the nvector_lite.py docstring.

This library is designed to work with arbitrary-shape/size Numpy arrays. By comparison, the original nvector implementation has inconsistent and unclear support for arrays of multiple points, i.e. anything other than shape (3, 1).

N-vector Lite is meant to be useful for "batch" computation over datasets of points stored in Numpy arrays, Pandas data frames, etc. — with much faster performance than you would be able to achieve with the original nvector library.

This is also useful for SQL-like database/query engines that support batched/vectorized Python UDFs, such as PySpark, DuckDB, and Snowflake.

Installation

I will set up PyPI publishing and a stable versioning scheme eventually. For now, install directly from Git using Pip:

pip install git+https://github.com/gwerbin/nvector-lite

Usage

Examples

Refer to the test suite, especially any test called test_example.

Development

Development requires Hatch.

Then, just clone the Git repository. Hatch will automatically set up the project environment when you run a command for the first time.

Run tests:

hatch run dev:pytest

Run an interactive Python console with hot-reloading enabled:

hatch run dev:repl

Run any other command (e.g. Python) in the dev environment:

hatch run dev:python ...
hatch run dev:python -m pdb ...
hatch run dev:/bin/sh ...
watch -n 60 hatch run dev:pytest -k test_example

About

Simple and flexible n-vector implementation in Numpy

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages