Skip to main content

Python package for software reliability analysis and modeling

Project description

pysrat

pysrat is a Python package for fitting and analysing NHPP (Non-Homogeneous Poisson Process) software reliability models. It provides a clean scikit-learn–style API (model.fit(data), params_, llf_, aic_) and high-performance EM core implementations exposed from C++ via pybind11.

Features

  • Scikit-learn–style estimators (model.fit(data), params_, llf_, aic_)
  • Fast EM updates implemented in C++ and exposed via pybind11
  • A collection of classical NHPP models and CF1 (canonical phase-type)
  • Plotting helpers for visualization (plot_mvf, plot_dmvf, plot_rate)
  • Multi-factor models (MFLogitNHPP, MFProbitNHPP, MFCloglogNHPP)
  • A Poisson regression–based framework (pr_nhpp_fit)

Installation

From source (recommended during development):

pip install pysrat

Requirements

  • Python ≥ 3.9
  • A C++20-capable compiler (required for some extension modules such as CF1)

Optional / developer tools

  • ninja (recommended build backend for faster CMake builds)
  • pytest for development and tests
  • Python headers and development toolchain for building native extensions

Quick start

import numpy as np
from pysrat.data.nhpp import NHPPData
from pysrat.nhpp.models import ExponentialNHPP
from pysrat.nhpp.plot import plot_mvf

# Create NHPP data from grouped intervals
data = NHPPData.from_intervals(time=[1, 1, 1, 1], fault=[0, 1, 0, 5])

# Fit model
model = ExponentialNHPP().fit(data)

print("Parameters:", model.params_)
print("Log-likelihood:", model.llf_)
print("AIC:", model.aic_)

# Plot mean value function
plot_mvf(data, model)

Working with data

pysrat accepts several NHPP data formats via pysrat.data.nhpp.NHPPData:

  • Interval/grouped data: NHPPData.from_intervals(time=..., fault=..., type=...)
  • Counts per interval: NHPPData.from_counts(fault=...)
  • Exact fault times: NHPPData.from_fault_times(times=..., te=... )

Available models

Common models are exported under pysrat.nhpp.models:

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

CF1 example

from pysrat.data.nhpp import NHPPData
from pysrat.nhpp.models 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_)

Plotting

Use the plotting helpers from pysrat.nhpp.plot:

from pysrat.nhpp.plot import plot_mvf, plot_rate
plot_mvf(data, model)
plot_rate(data, model)

You can pass a dictionary of models to compare multiple MVFs:

models = {
    "Exp": ExponentialNHPP().fit(data),
    "Gamma": GammaNHPP().fit(data),
}
plot_mvf(data, models)

Model comparison

Compare models using aic_ or llf_:

from pysrat.nhpp.models import ExponentialNHPP, GammaNHPP
data = NHPPData.from_counts([0, 1, 0, 5])
m1 = ExponentialNHPP().fit(data)
m2 = GammaNHPP().fit(data)
best = min((m1, m2), key=lambda m: m.aic_)
print("Best model:", best.name)

Examples

See the examples/ notebooks included in the repository for end-to-end workflows (basic fitting, comparison, CF1 usage and plotting):

  • examples/example1.ipynb — Exponential NHPP
  • examples/example2.ipynb — CF1 fitting and comparison
  • examples/example3.ipynb — Multi-factor models (MFLogitNHPP)
  • examples/example4.ipynb — Poisson regression–based NHPP fitting (pr_nhpp_fit)

Contributing

Contributions are welcome. Please open an issue describing the change or a PR with tests and documentation updates.

License

This project is distributed under the terms of the MIT License. See LICENSE.

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.2.1.tar.gz (2.7 MB view details)

Uploaded Source

Built Distributions

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

pysrat-0.2.1-cp313-cp313-win_amd64.whl (469.4 kB view details)

Uploaded CPython 3.13Windows x86-64

pysrat-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (571.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pysrat-0.2.1-cp313-cp313-macosx_11_0_arm64.whl (440.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pysrat-0.2.1-cp313-cp313-macosx_10_13_x86_64.whl (486.8 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pysrat-0.2.1-cp312-cp312-win_amd64.whl (469.4 kB view details)

Uploaded CPython 3.12Windows x86-64

pysrat-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (571.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pysrat-0.2.1-cp312-cp312-macosx_11_0_arm64.whl (440.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pysrat-0.2.1-cp312-cp312-macosx_10_13_x86_64.whl (486.6 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

pysrat-0.2.1-cp311-cp311-win_amd64.whl (465.9 kB view details)

Uploaded CPython 3.11Windows x86-64

pysrat-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (565.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pysrat-0.2.1-cp311-cp311-macosx_11_0_arm64.whl (436.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pysrat-0.2.1-cp311-cp311-macosx_10_9_x86_64.whl (481.0 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pysrat-0.2.1-cp310-cp310-win_amd64.whl (463.9 kB view details)

Uploaded CPython 3.10Windows x86-64

pysrat-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (562.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pysrat-0.2.1-cp310-cp310-macosx_11_0_arm64.whl (433.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pysrat-0.2.1-cp310-cp310-macosx_10_9_x86_64.whl (476.9 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pysrat-0.2.1-cp39-cp39-win_amd64.whl (469.0 kB view details)

Uploaded CPython 3.9Windows x86-64

pysrat-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (563.8 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

pysrat-0.2.1-cp39-cp39-macosx_11_0_arm64.whl (433.5 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pysrat-0.2.1-cp39-cp39-macosx_10_9_x86_64.whl (477.1 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pysrat-0.2.1.tar.gz
Algorithm Hash digest
SHA256 7a4a7b3fdc60fbc19d7c3a9bff6bb647704dbc051579fc02cfc3e7d6d87eecd9
MD5 96e61ac3256791e5dfd8549f838cc041
BLAKE2b-256 79a754e7c7b3df54529c6185f0bd45abc27053a687ad078ba2b9860133062a33

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysrat-0.2.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 469.4 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.2.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 94a5323787c646f8a0250cdf53cf471e0dabee0add12363f3e4711fa0d48e4e0
MD5 b86663946d88ba33d370e7fe17e16af6
BLAKE2b-256 0fd2efd2b0dbd63fc50f0544b6a8e1cc9df1192e720f313ca7f1171007c15a42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ae0dd938aa15948a3f3199b2c75b6e2958c1af7b9d3687c4d5e0881eb1346ca2
MD5 5f7992bc8f93a44dbc7dd649f3a585a6
BLAKE2b-256 1c563e30bd885aadf5c57d5fec4d2ffd10fb22e5bde71cf181484adf01724b16

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ff9efe7a1d66143162f20caf0d0639ef4529f1c862e4f62b21b2ee3825679d98
MD5 fc4c9c1302e1fab65eff7e205f5bcbdb
BLAKE2b-256 e4edb14ca7e9c7feabf4db580d5c4009809d37b1b35573fba5cc0e8b7c2bf4d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.1-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 8f4c709b51ba4c2cd41d57e4c14b8ba5c5c4548674da3cc9a435440b9b3987f6
MD5 ae3f154043303c0afcebc86d0c596a78
BLAKE2b-256 163123f511a55dbb7fd93caf9dd237b3bed1a4c3babf7db94dc28c1bb6a2b7d9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysrat-0.2.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 469.4 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.2.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 87d1b9b917eaa6704794f6d7057405bd0611232463da02637207473bdfd7c744
MD5 51a7d486e15abc139f952f321620a472
BLAKE2b-256 aba52fd0e6badc39245b5f7b67057b868c7839172f3fef0e2d65bae92c32c305

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d1e8a9d418f540afc666b0739ab8534abc390240229a387688bd91c193daa4dc
MD5 cf3b738198618bfcde662075301b2d23
BLAKE2b-256 1ef5ff2003837ef20583224057851996b8c37e13def90a727ebdb4b2031cf688

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4e3bc4338dfd2fb88d96b2923f327c88f484544e1776574525c463e1fb334b65
MD5 d443d43664e9d702c648179397de0200
BLAKE2b-256 c23a04fea7155604b8e2baba1fcfb24cf903b7a72d6788886fef60930d72eac8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.1-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 61f9fd0d24532a8fa9149565926ab832b434c8349bfbca48d6a5166df57e9441
MD5 fa5539ec5634a3b48ac44eda37074771
BLAKE2b-256 bf96c18eb3cd28a2fb0cb9d2151ce62842d0d79431590f2574c27448c5f4b57d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysrat-0.2.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 465.9 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.2.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 74e17a2c66a8c0e77c90ed4f10c085a42eed2b22dea53eed747539fa8b6e5225
MD5 88836834455ed7ae676f8d8152b86d06
BLAKE2b-256 c4ad1a49521ef2ad4725684ef2d81278ed2d2807e5c876f42a07ef6f7b335624

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 812694fbed522770e96c32be6b8b7f950ae54b7fb7b35e560048488235988f30
MD5 30c3502373a5304f73a846b307475df8
BLAKE2b-256 d1d97f05aea973896e76f578db2d3927a8916b5ab348b50e7dc7d8753bc5bd0d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c21280e7c56b2729b3f8665dd73b8b41066024d8207d8b9bf51e41d2e199555e
MD5 810e02f739dc1e24fb44bad44ca03086
BLAKE2b-256 391074bdb0ded1920e711426d32cfbfee4a74cb22a8ef2c8f76efc2befe32e8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4afb3fd32a49dda8a6c234936887b1c2cf1915a5e753b972d9e1af08924ae706
MD5 caa55e8658bb4911805d10b2d12be17b
BLAKE2b-256 690c42e5ca5455982cc43d0401e5b686098c522752208d0205c4cc4efbb4b522

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysrat-0.2.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 463.9 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.2.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c47605cdbe6a07ee01b6904c08bcfa99fec869e74db465680f4fb71d521fd6be
MD5 350499702375b45d43ada3151d150054
BLAKE2b-256 c4e4a6379144dcee27c95152337775047b28f3c1dac70e0ef1bde3207f09b9d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f6e17c888b0f795ed85c65a80c1a28d3e6962b3f6484453ced8effc10548d3c6
MD5 e305024c417ef929cecbc2abfa6c8691
BLAKE2b-256 fd4040bca59caa6356f8ac4cc1f7a1bef60a5b9fc7230f7147550fd6bdceac64

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ca92a8887219b51c58758f96ea6818e5342ecf4f375bbc99103329f252310986
MD5 ece088d1c647dc30535dfd50637a355e
BLAKE2b-256 58c13e40eb85b00dc8950bd009e756890aaaf5a1575c74c62fd32ee5012b82a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 58ac1d63f707b3d57f96abe325fceb4b4cc5978c899479d1823c29524bd53712
MD5 3874945bdfc16741ad3881a9896dfd1c
BLAKE2b-256 25ba9bf62fb3092a4086d5f250387111696149691339412454f375aed8e7afcc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysrat-0.2.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 469.0 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.2.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 0542533b71a7c9cd4baec3284b4607cfac455b29ef1e88cda9f5fb40e19de2a1
MD5 50932a22056283165844fb98d2daf7c8
BLAKE2b-256 fc1620fe4597d429579ddbbd16528f6f3be032e9bfd3955c5f6f12cd78ee7390

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0dbc4795ecb950228ea99e4fc60770ba94aad052a1f476b4934cd190bb28faea
MD5 0c0898a81cf74bab95d9bd915a7e3a88
BLAKE2b-256 2d59af11fce2f9a1a060aad8b6b7ef9a6cb06fab5f26167563a2644cce96adcc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a8770a1d197283b1bfc62fcb6b9bcf9452eabe7fc304d419c0f5fcc9d27115e5
MD5 91c729c42856da4c076fde034ea040e6
BLAKE2b-256 87f446feaf30adda01ab3674610c79f90d99a4099003501624f31db739dcbb27

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a429a112c92f9fd4b597b666f1aae0b90538d8d77bad713be3ed5816af02807f
MD5 73c7e519c9fe4e01049bc8242a36faf8
BLAKE2b-256 642878f0b71a2faf6187bb339f5e678eed8ac636b1d746c7aac8b2bfc197178b

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