Skip to main content

Statistics of list of (x, y) pairs from calculator-style summation registers.

Project description

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 pysumreg
  • conda install -c conda-forge pysumreg
  • mamba install -c conda-forge pysumreg
  • micromamba install -c conda-forge pysumreg

About

Release PyPI Conda-forge Platforms
Release PyPI Conda Version Conda Platforms
Python Unit Tests Code Coverage
Python Unit Tests Coverage Status

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

pysumreg-1.0.6rc3.tar.gz (34.9 kB view details)

Uploaded Source

Built Distribution

pysumreg-1.0.6rc3-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file pysumreg-1.0.6rc3.tar.gz.

File metadata

  • Download URL: pysumreg-1.0.6rc3.tar.gz
  • Upload date:
  • Size: 34.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for pysumreg-1.0.6rc3.tar.gz
Algorithm Hash digest
SHA256 7ff1ca3e7d3be51833c06d7ac03147010ed3e82b8d53279db934a6387f35b78f
MD5 cab320b9224b2534e6e13c9dfb93aa16
BLAKE2b-256 817b640510b936725ff93eac945e4db9780e16d2ca7b3f7c14626a0648ff4e98

See more details on using hashes here.

File details

Details for the file pysumreg-1.0.6rc3-py3-none-any.whl.

File metadata

  • Download URL: pysumreg-1.0.6rc3-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for pysumreg-1.0.6rc3-py3-none-any.whl
Algorithm Hash digest
SHA256 a9ae28921bb436793a5f0d83ec15007dfa56985ca1d489abbe500c2ae35213fc
MD5 5e3f05836fd8f586d78b2460772220e7
BLAKE2b-256 4bc2fcdaa55bf17b4c675a66d6a56f30df7dacbebf361a3e5aba3286bce0545d

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