Skip to main content

pamoja-kit

Plain-language helper math: smoothing, calibration, PID and thermostat control, a trigger with hysteresis, trend and surge prediction, rolling windows, kinematics, and geo. One capability of pamoja, one memory-safe Rust core with bindings for TypeScript, Python, and C#.

read the guide documentation API reference

Install

pip install pamoja-kit
from pamoja import kit

This pulls in pamoja-native, the compiled engine. pip install pamoja is the whole framework in one package.

Example

The script the test suite runs, spliced here as it ran.

From bindings/python/guides/kit.py:

from pamoja.kit import Calibration, Median, Thermostat

# A 4-20 mA process loop carries the level as a current: 4 mA is empty and 20 mA is full,
# so the span is 16 mA and mid-scale is 12 mA, not 10.
level = Calibration.two_point(4.0, 0.0, 20.0, 100.0)
print(f"12 mA is {level.apply(12.0)}% full, 4 mA is {level.apply(4.0)}%")

# The live zero is what makes a broken loop detectable: 0 mA is off the bottom of the
# scale rather than an empty tank.
broken = level.apply(0.0)
print(f"a dead loop reads {broken}%, which is not a level at all")

# A median window drops that sample outright, where an average would blend a quarter of
# the range into every reading after it.
filtered = Median()
percent = 0.0
for milliamps in (12.0, 12.0, 0.0, 12.0, 12.0):
    percent = level.apply(filtered.update(milliamps))
print(f"through the dropout, the level held at {percent}%")

# A refill pump runs when the level falls below the deadband, which is the direction
# heating names; nothing about it is specific to temperature. The deadband stops a level
# sitting on the threshold from chattering the contactor.
pump = Thermostat.heating(50.0, 10.0)
for reading in (percent, 38.0, 45.0, 62.0):
    running = "on" if pump.update(reading) else "off"
    print(f"at {reading}% the pump is {running}")

The same capability in every language

Language Package Reference
Rust pamoja-kit reference, docs.rs, install
TypeScript @pamoja/kit reference, install
Python pamoja-kit reference, install
C# Pamoja.Kit reference, install

Documentation

License

MIT

Release files for pamoja-kit 0.1.18

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pamoja-kit 0.1.18
File Size Uploaded
pamoja_kit-0.1.18.tar.gz 4.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pamoja-kit 0.1.18
File Interpreter ABI Platform
pamoja_kit-0.1.18-py3-none-any.whl Python 3 none any Details

Total release size: 10.3 kB

Release files / pamoja_kit-0.1.18.tar.gz

Download URL pamoja_kit-0.1.18.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
17a56eaa5bb1aef47993699762b34e611348a53bfdd4df10c1e2d1f6440e0ee9
BLAKE2b-256 checksum
How to use checksums
f74b9fe1265d4a8f7f9c2882af39be457c95642967ef21257b7a3215f8faf3ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / pamoja_kit-0.1.18-py3-none-any.whl

Download URL pamoja_kit-0.1.18-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9301e2775b99569ad52ccab1ae566161e8bd589d4c10f719e3ec18caf094d115
BLAKE2b-256 checksum
How to use checksums
9f9ce10b8ad2b8c17228256a290f1d161f6bc180b095400b7a6839b1397fa432
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release history Release notifications | RSS feed

0.2.0

2 release files

This release

0.1.18 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page