Skip to main content

Python package for software reliability analysis and modeling

Project description

pysrat

Python implementation of NHPP (non-homogeneous Poisson process) software reliability models with a C/pybind11 core and a Pythonic estimator API.

Features

  • Scikit-learn–style estimators: model.fit(data) and params_/llf_/aic_
  • NHPP data helpers: NHPPData.from_intervals(...), from_counts(...), from_fault_times(...)
  • Fast EM updates in C via pybind11
  • CF1 (canonical phase-type) NHPP model and distribution helpers
  • Simple plotting helpers (plot_mvf, plot_dmvf, plot_rate)

Installation

python -m pip install -U pip
pip install -e .

Notes:

  • A C++20-capable compiler is required to build the CF1 extension module.

Quick start

import numpy as np
from pysrat import NHPPData, ExponentialNHPP, plot_mvf

data = NHPPData.from_intervals(time=[1, 1, 1, 1], fault=[0, 1, 0, 5])

model = ExponentialNHPP().fit(data)
print(model.params_)
print(model.aic_)

plot_mvf(data, model)

CF1 example:

import numpy as np
from pysrat import NHPPData
from pysrat.models.cf1 import CanonicalPhaseTypeNHPP

data = NHPPData.from_intervals(time=[1, 2, 1.5], fault=[1, 0, 2], type=[0, 1, 0])
model = CanonicalPhaseTypeNHPP(3).fit(data)
print(model.params_)

API overview

Data

  • NHPPData.from_intervals(time=..., fault=..., type=..., te=...)
  • NHPPData.from_counts(fault=...)
  • NHPPData.from_fault_times(times=..., te=...)

Models

  • ExponentialNHPP (exponential)
  • TruncatedNormalNHPP, Pareto2NHPP, GammaNHPP, LogNormalNHPP
  • TruncatedLogisticNHPP, LogLogisticNHPP
  • TruncatedExtremeValueMaxNHPP, LogExtremeValueMaxNHPP
  • TruncatedExtremeValueMinNHPP, LogExtremeValueMinNHPP
  • CanonicalPhaseTypeNHPP (CF1)

Model comparison

from pysrat import compare, ExponentialNHPP, NHPPData

data = NHPPData.from_counts([0, 1, 0, 5])
fitted, best = compare([ExponentialNHPP()], data, criterion="AIC")

Distributions

R-like helpers live under pysrat.dists, e.g.:

from pysrat.dists import dcf1, pcf1, rcf1

alpha = [0.4, 0.3, 0.3]
rate = [0.5, 1.0, 1.5]
print(dcf1([0.1, 0.5], alpha=alpha, rate=rate))
print(pcf1([0.1, 0.5], alpha=alpha, rate=rate))
print(rcf1(5, alpha=alpha, rate=rate))

Plotting

  • plot_mvf(data, model_or_results)
  • plot_dmvf(data, model_or_results)
  • plot_rate(data, model_or_results)

Note: Only the plot_* functions above are exported; legacy aliases like mvfplot, dmvfplot, and rateplot are not provided.

model_or_results can be an NHPPModel, a dict[str, NHPPModel], or a list of models.

Hyperparameters

Models expose sklearn-style hyperparameters via get_params()/set_params(). For example:

model = ExponentialNHPP(omega0=1.0, rate0=1.0)
model.set_params(rate0=0.5)

Development

python -m pip install -U pip
pip install -e .[dev]
pytest -q

Release

Tag and push to trigger the PyPI release workflow:

git tag v0.1.0
git push --tags

Set either:

  • PYPI_API_TOKEN secret for token-based upload, or
  • Trusted Publishing (OIDC) in PyPI and keep the workflow permissions as-is.

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

pysrat-0.1.1.tar.gz (346.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pysrat-0.1.1-cp313-cp313-win_amd64.whl (255.8 kB view details)

Uploaded CPython 3.13Windows x86-64

pysrat-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (327.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pysrat-0.1.1-cp313-cp313-macosx_11_0_arm64.whl (241.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pysrat-0.1.1-cp313-cp313-macosx_10_13_x86_64.whl (260.3 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pysrat-0.1.1-cp312-cp312-win_amd64.whl (255.7 kB view details)

Uploaded CPython 3.12Windows x86-64

pysrat-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (327.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pysrat-0.1.1-cp312-cp312-macosx_11_0_arm64.whl (241.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pysrat-0.1.1-cp312-cp312-macosx_10_13_x86_64.whl (260.2 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

pysrat-0.1.1-cp311-cp311-win_amd64.whl (253.5 kB view details)

Uploaded CPython 3.11Windows x86-64

pysrat-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (324.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pysrat-0.1.1-cp311-cp311-macosx_11_0_arm64.whl (238.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pysrat-0.1.1-cp311-cp311-macosx_10_9_x86_64.whl (256.5 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pysrat-0.1.1-cp310-cp310-win_amd64.whl (252.5 kB view details)

Uploaded CPython 3.10Windows x86-64

pysrat-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (322.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pysrat-0.1.1-cp310-cp310-macosx_11_0_arm64.whl (236.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pysrat-0.1.1-cp310-cp310-macosx_10_9_x86_64.whl (253.7 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pysrat-0.1.1-cp39-cp39-win_amd64.whl (255.1 kB view details)

Uploaded CPython 3.9Windows x86-64

pysrat-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (323.4 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

pysrat-0.1.1-cp39-cp39-macosx_11_0_arm64.whl (236.2 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pysrat-0.1.1-cp39-cp39-macosx_10_9_x86_64.whl (253.9 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

Details for the file pysrat-0.1.1.tar.gz.

File metadata

  • Download URL: pysrat-0.1.1.tar.gz
  • Upload date:
  • Size: 346.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysrat-0.1.1.tar.gz
Algorithm Hash digest
SHA256 be34e8d3b29c1424ff03269477742a08cb0556d5fccad83806ac0916de4a4290
MD5 16b6036644a52c56a1201da0729ffbc8
BLAKE2b-256 1f4bc601a31dab6187dd61e5c08a5b1b2ccc66d1acb4cd08af8adcaabf860f62

See more details on using hashes here.

File details

Details for the file pysrat-0.1.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pysrat-0.1.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 255.8 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysrat-0.1.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 471a39514751c882970bac040040f5f45cf9fd03fbd96dfa5f1c9618a5e08ce1
MD5 40c5c477ce4b77967b8af85a1fde9e07
BLAKE2b-256 36e66376d2f00e9b735856d03feffacaa9ffa191af07463a41e6c6fc4d903c36

See more details on using hashes here.

File details

Details for the file pysrat-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pysrat-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ab07e8c98df4108458e96c90c0a52e660aa0ffd3787345a320be5946eca9ce04
MD5 aeec64741fa7286380a09b062f4d225c
BLAKE2b-256 c486c13f4172f4be46eec3bc5e26d77f33bb98ef96196ddc09e3409827c263d7

See more details on using hashes here.

File details

Details for the file pysrat-0.1.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pysrat-0.1.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 70a10dfa29b8722981b1aafacdda05ae2356bd196d891724c6cc5ecae045ddb1
MD5 d0c3aa5094ce0e23b9b36afa57f5b5f9
BLAKE2b-256 e909bbee921ac1a5a3dcd2adacfff3837fc2e1c51525681ee5c19ce2f727877d

See more details on using hashes here.

File details

Details for the file pysrat-0.1.1-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pysrat-0.1.1-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 c6319429b0f851a64fb482a014b0adbfedb170b559c3f197bc5c076ffc7ee0c9
MD5 da6476ced7f25d16f897a99cd9b49b2f
BLAKE2b-256 19a578087a9ddcb4dcdd0c571d15cb6594c26a4cf4cbcd081477e5bab27bf56a

See more details on using hashes here.

File details

Details for the file pysrat-0.1.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pysrat-0.1.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 255.7 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysrat-0.1.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 73f9c8bcd18738dd3b06a591756b7cd6d3dfaa320a1661e81a222652f2d4a93e
MD5 90ea681196c12fc3d0f06c618be2a226
BLAKE2b-256 c74d72ba629db1a1642c08231d205a3d2662dd0489d86c312a81acbd5a046630

See more details on using hashes here.

File details

Details for the file pysrat-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pysrat-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 88111255f8e3280ea348af6408e7d8770457c4e7697e9d2bea123d662ba97c55
MD5 7c8f265f58103d320a42235e7864e62a
BLAKE2b-256 1a3a1e011d9fa28bcedaebfe64d52a4cf03fb7e17217ce969eea261b3cc8f40c

See more details on using hashes here.

File details

Details for the file pysrat-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pysrat-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2b4d1217c7d145478ff414e8e87d3f983eca174b71f748804c4f46268ddd7edf
MD5 f92feb76b8b103f2918c77a57f824a19
BLAKE2b-256 5ddb7a748a5c23d5e8b08e3926f44c7f92c888502153f4794c980aac86c3a3fe

See more details on using hashes here.

File details

Details for the file pysrat-0.1.1-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pysrat-0.1.1-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 9573270c7448ff04c4645812631a45a5244068a6619e69f026cb16d28231b8c3
MD5 10c05853dd632fd101f0b3150ef81f92
BLAKE2b-256 ab81dd70df85420a27de350dfdc6544e9267ede88a39f21ed40f80e7b6c18c7f

See more details on using hashes here.

File details

Details for the file pysrat-0.1.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pysrat-0.1.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 253.5 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysrat-0.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c3de63a8dbf5359f808763c99cc34465fe702f6b699be4d1d9f04edb45e5d70d
MD5 610b5e54d1f3f4c465d9d4d2cb8db98f
BLAKE2b-256 1d745e483c55b78cf9938b27846c228c0f88204d18068d8149ae99df3f9aa9f3

See more details on using hashes here.

File details

Details for the file pysrat-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pysrat-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0d7c33e2c90566954b1013a6c4cfb6d63c216ae0fcecba7d992d48ebbd17761b
MD5 6e4925d0c0f180d1e612485cbeec6275
BLAKE2b-256 f1a0d5a057c0f7704c6c2ed4690882d9b3259cf472abed3867e4fb3fba9b0313

See more details on using hashes here.

File details

Details for the file pysrat-0.1.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pysrat-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3c6b03d6e679c2131b3a066df40e042f60a21e89ff6caa6c43be0cb230bc28f7
MD5 4894ad3c9b66cd97cfecce2f03253338
BLAKE2b-256 f6d0eecf448a4f35b257fd487d93383108abe136f57efcd8ad32cce6c90ba854

See more details on using hashes here.

File details

Details for the file pysrat-0.1.1-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pysrat-0.1.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6f9712b5741ff069b2abff7e606c6eb3a05efbff6646158030d5fc1ca9a7ae8b
MD5 204141fa23219314146a6c6612678ac8
BLAKE2b-256 0bd54cd6c58a58811f9a59d887f3eb561034da63d34e463bdb4c3e53fd6772f6

See more details on using hashes here.

File details

Details for the file pysrat-0.1.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pysrat-0.1.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 252.5 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysrat-0.1.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a54fee7fbbdb2c87c9618ca674eb494103394dfc9bb0a23822f2d4bb468e83b3
MD5 afbf6bf067cb0b766237dd3a9bc94919
BLAKE2b-256 55a7c5fdf461c25960b7466ef45cf10143782a527f61d7a400a80398d2e8a0fa

See more details on using hashes here.

File details

Details for the file pysrat-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pysrat-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 738274303bae65cd22623e83052a3d0c22723879ec36788b9bc4fd781354a756
MD5 75ad8e0ec117ee9a1b9fb35a01626e3b
BLAKE2b-256 56fc1297a1e5c35cdebe68935e4568e00790a5975c0c4a672bd72fc90aa18793

See more details on using hashes here.

File details

Details for the file pysrat-0.1.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pysrat-0.1.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ed3d982786b154c2d06ebb14115682dbad758c2cc6c6cba38d11c75be1fc435f
MD5 6dd4f4268c26b3f06de08d48d539c992
BLAKE2b-256 4d4315f8971944dae727b8b3f8805deea4ac6c6c2b9f6ec391d11fc489ec91d0

See more details on using hashes here.

File details

Details for the file pysrat-0.1.1-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pysrat-0.1.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a0c7e9e46bb0c8b65ca4b9dcdb4dbab898164d6ea58de0fc67e60af230018b0a
MD5 b885249b602873716a9fe44325b4e1f7
BLAKE2b-256 fef59c52e631596a652f55154e4ec1ea3adc8f10744040be3ffe6717d4e9abed

See more details on using hashes here.

File details

Details for the file pysrat-0.1.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pysrat-0.1.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 255.1 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysrat-0.1.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f63e749e9d9102d45d3d5ed7b34a98636acc0949e0127acc8f00e1ab0f6108b1
MD5 0a351b3fb58b0b50cf66890dae9035bf
BLAKE2b-256 a22e99de2084f72b0265655c22845bc7c9888920240a537ca892567ae3bd72d1

See more details on using hashes here.

File details

Details for the file pysrat-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pysrat-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9605a9958ee4323776a2086ad71f40b48c1b91991f7221156bd0da74d17cdc8f
MD5 b5c6adf4167a083d0aaf3d4e2414e20a
BLAKE2b-256 000f715f34f6b23f624def0ea1cb62423cd44ec5cf97083acb25213083bf7d11

See more details on using hashes here.

File details

Details for the file pysrat-0.1.1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pysrat-0.1.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 045c4d9eecfebb95cd9f5363ee24f0aa833b9118c2dbe042203e89e0d1c63593
MD5 f72cee54bbb2f1880e39bcf565c244ed
BLAKE2b-256 eda96b48d497f2c7f5c80015e63dd9392042a2d5e9232953e602fa0ec114d0af

See more details on using hashes here.

File details

Details for the file pysrat-0.1.1-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pysrat-0.1.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6e9904feb844dd23d82ccd9446ff8f4d9fefed486cf193dc363d0f8dea4b23b3
MD5 d6d5abfee273cda3876b51a00002d2db
BLAKE2b-256 bbc351790ecac31043ba475737f7d0087efcef91c2d4cc3ddca885a35f772520

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