Skip to main content

Python wrapper around GNU GSL 2.8 running statistics

Project description

gsl-rstat

Python wrapper around GNU GSL 2.8 running statistics.

Installation

This package depends on the gsl_rstat_* and gsl_rstat_quantile_* functions declared in gsl_rstat.h, provided by the GNU Scientific Library (GSL) v2.8. Since this package provides only a thin wrapper around these functions, you'll need both the GSL v2.8 binaries and headers installed on your system before you can install and use it. For Debian 13 (Trixie) and Ubuntu 25.0 (Questing Quokka) you can get these from the package repos. E.g., using apt

apt-get update && apt-get install libgsl-dev gsl-bin

If v2.8 is not available via the package repos for your distribution, you'll need to build these from source. In such a scenario, either ensure that both the headers and binaries libgsl.so and libgslcblas.so are either in one of the standard locations on your system, or point your compiler and linker to the appropriate places, e.g., by setting the following environment variables

export CFLAGS="${CFLAGS} -I/path/to/gsl-headers"
export LDFLAGS="${LDFLAGS} -L/path/to/libgsl.so -L/path/to/libgslcblas.so"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/path/to/libgsl.so:/path/to/libgslcblas.so"

Finally,

($) python -m venv .venv
($) . .venv/bin/activate
($) pip install --upgrade pip && pip install gsl-rstat

Usage

See the GNU GSL documentation for the available running statistics & their definitions

from gsl_rstat import RStat, RStat_Quantile

my_rstat = RStat()
my_rstat_quantile = RStat_Quantile(0.3)

my_rstat.add(22)
my_rstat.add(443.5)

my_rstat_quantile.add(12)
my_rstat_quantile.add(-22.)
my_rstat_quantile.add(443.2)

print(f"n = {my_rstat.n}, mean = {my_rstat.mean}, rms = {my_rstat.rms}")
print(f"30% quantile = {my_rstat_quantile.get()}")

my_rstat.reset()
my_rstat_quantile.reset()

log.c

This project uses log.c by rxi to optionally log C struct heap allocations and deallocations. To enable add -DLOGGING to the CFLAGS environment variable when building the package from source

export CFLAGS="${CFLAGS} -DLOGGING"

Build GNU GSL v2.8 from source

To do

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gsl_rstat-1.0.tar.gz (10.2 kB view details)

Uploaded Source

File details

Details for the file gsl_rstat-1.0.tar.gz.

File metadata

  • Download URL: gsl_rstat-1.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for gsl_rstat-1.0.tar.gz
Algorithm Hash digest
SHA256 7c462d4adb03df9e460e4529845233fdf4e25c64721bee520d3bdc2ddd4c74d9
MD5 a6faa7de6dba6c3b3a89d45deadfdcfc
BLAKE2b-256 6be9e11b6446c95804981d1abfedbe8d1486b45f60f93233c87e2c898ec1976f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page