Statistics with Calculator-style Summation Registers
Statistics of list of (x, y) pairs from calculator-style summation registers.
CONTENTS
Why use this package?
Use this package to obtain summary statistics of a list of $(x, y)$ pairs when the pairs are presented in sequence, such as from a control system. It is not necessary to retain the entire list in memory, this package will retain the cumulative values necessary to compute all analytical results.
There are no external dependencies on add-on packages such as numpy or scipy. Only the math package from the Python Standard Library is used.
Statistics may be calculated at any time from the summation registers.
The $(x, y)$ values may be entered in any order. It is not necessary to sort them.
Examples
In [1]: import pysumreg
In [2]: reg = pysumreg.SummationRegisters()
mean and standard deviation
In [3]: reg.clear()
...: reg.add(1, -1)
...: reg.add(2, -2)
...: reg.add(3, -3)
...: print(f"{reg.mean_x=}")
...: print(f"{reg.stddev_x=}")
...: print(f"{reg.mean_y=}")
...: print(f"{reg.stddev_y=}")
...: print(f"{reg.min_x=}")
...: print(f"{reg.max_x=}")
...: print(f"{reg.min_y=}")
...: print(f"{reg.max_y=}")
...: print(f"{reg.x_at_max_y=}")
...: print(f"{reg.x_at_min_y=}")
...:
reg.mean_x=2.0
reg.stddev_x=1.0
reg.mean_y=-2.0
reg.stddev_y=1.0
reg.min_x=1
reg.max_x=3
reg.min_y=-3
reg.max_y=-1
reg.x_at_max_y=1
reg.x_at_min_y=3
linear regression & correlation coefficient
In [4]: reg.clear()
...: reg.add(1, -1)
...: reg.add(2, -2)
...: reg.add(3, -3)
...: print(f"{reg.correlation=}")
...: print(f"{reg.intercept=}")
...: print(f"{reg.slope=}")
...:
reg.correlation=-1.0
reg.intercept=0.0
reg.slope=-1.0
peak analysis: centroid and width of x weighted by y
In [5]: reg.clear()
...: reg.add(1, 0)
...: reg.add(2, 1)
...: reg.add(3, 0)
...: print(f"{reg.max_y=}")
...: print(f"{reg.centroid=}")
...: print(f"{reg.sigma=}")
...:
reg.max_y=1
reg.centroid=2.0
reg.sigma=0.0
In [6]: reg.add(1.5, 0.5)
...: reg.add(2.5, 0.5)
...: print(f"{reg.max_y=}")
...: print(f"{reg.centroid=}")
...: print(f"{reg.sigma=}")
...:
reg.max_y=1
reg.centroid=2.0
reg.sigma=0.3535533905932738
Installation
This package may be installed by any of these commands:
pip install pysumregconda install -c conda-forge pysumregmamba install -c conda-forge pysumregmicromamba install -c conda-forge pysumreg
About
| Release | PyPI | Conda-forge | Platforms |
|---|---|---|---|
| Python | Unit Tests | Code Coverage |
|---|---|---|
- documentation: https://prjemian.github.io/pysumreg/latest
- source: https://github.com/prjemian/pysumreg
Metadata
Release files for pysumreg 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pysumreg-1.0.7.tar.gz | 34.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pysumreg-1.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 51.3 kB
Release files / pysumreg-1.0.7.tar.gz
| Download URL | pysumreg-1.0.7.tar.gz |
|---|---|
| Size | 34.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8fd8718ca5aa5dca4495ed8d066913fa82010fcf6d8cf57efe0745ffd9c43dc1
|
|
BLAKE2b-256 checksum How to use checksums |
93e61bfa6c430601ed13b327715341ef31ac1b5688cd999a4f187505e71294d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Release files / pysumreg-1.0.7-py3-none-any.whl
| Download URL | pysumreg-1.0.7-py3-none-any.whl |
|---|---|
| Size | 16.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
67015918cbc65be74e4dd00d0d74163b067a2f8be310c60e21bacb381b2bff08
|
|
BLAKE2b-256 checksum How to use checksums |
0179702b8757fe9b9aa67ba820f607a083ce265fdd2b8e7d18dbe4252d21204c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Security for pysumreg 1.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.