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.2.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.2-cp313-cp313-win_amd64.whl (469.5 kB view details)

Uploaded CPython 3.13Windows x86-64

pysrat-0.2.2-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.2-cp313-cp313-macosx_11_0_arm64.whl (440.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.13macOS 10.13+ x86-64

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

Uploaded CPython 3.12Windows x86-64

pysrat-0.2.2-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.2-cp312-cp312-macosx_11_0_arm64.whl (440.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.12macOS 10.13+ x86-64

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

Uploaded CPython 3.11Windows x86-64

pysrat-0.2.2-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.2-cp311-cp311-macosx_11_0_arm64.whl (436.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.11macOS 10.9+ x86-64

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

Uploaded CPython 3.10Windows x86-64

pysrat-0.2.2-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.2-cp310-cp310-macosx_11_0_arm64.whl (433.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.10macOS 10.9+ x86-64

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

Uploaded CPython 3.9Windows x86-64

pysrat-0.2.2-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.2-cp39-cp39-macosx_11_0_arm64.whl (433.5 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pysrat-0.2.2-cp39-cp39-macosx_10_9_x86_64.whl (477.2 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: pysrat-0.2.2.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.2.tar.gz
Algorithm Hash digest
SHA256 ffb747e0139cd02f5dcb412887deb307a7d0ca4c643d6c20e0739e646a70b46f
MD5 2a0f1c023dc45e55e681de607367589f
BLAKE2b-256 f5068f20b7d1de5526ab93863f354eaa6f60b9441a6f61b9b193ed2b9d686fa3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysrat-0.2.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 469.5 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.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 fa85c22b35b37c6bf28daf731aaa4099184b8b15ab0539d83a42fadd11821290
MD5 662cfcbd74d1d7b8b53d1f21e35afcc0
BLAKE2b-256 493f0db5552c5a934d6a5b1523640b96bab20f9edc6e5a18a490494c22e50a0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d81ac282f4e50168791367f329447cae9dda129f1de1f6fb6db4ec123f77596b
MD5 642d58d280ead22d21aa8f43894a6a7a
BLAKE2b-256 59a17f744977666b67e170d18e5a3294c1c1309c449c6efe6e7e6d16710ba16b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ed6f74409bead195c941076deb4eab0597a74acf4a002d6f6f93a52608cb1761
MD5 d319321ffba4187e025cdcde35e2bd30
BLAKE2b-256 c9c3e04c46edbf6088bd474d53e96eaf8fdb3f5e27ca1a7e3e8588f0a0ac49f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.2-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 c08f7bd7afb2fdb4d0a629c53e89b9b38f56bb3fd46d222c1ee1ada3f81c3326
MD5 adb741d3f9a65984767cdd150f6c6e4d
BLAKE2b-256 4886321c67e1d4922a7f21a159d5e3c8cef078f7f69c08bc09171ec1a75ec454

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysrat-0.2.2-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.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0e33414686cc7eb88fb611cafd5b5da8c8f8693564e487407ad32fa317273bbb
MD5 580b307ad0d80de3f44c385c19067630
BLAKE2b-256 bfb99352189867728af4f8db9363f5d15668b34c309caadfd1e9916def3ee895

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bb3cfc5b221eb43a1e3e2f4a1d711178452a1dae880e7afbb353670eec44dd78
MD5 9f044c9ee92552332d10cdd95f535731
BLAKE2b-256 767d5ac81204d5507abec7d4966ba6dd5051fedf7e44eba3ffea7774550e90cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6e292fea3e7a913f0d3a7c4f8d7b5fa3155fc9bc5ec087ce7db8d7b8a7eaf695
MD5 129b5182e1f77e06c21e10112c5188d8
BLAKE2b-256 b66c9568244745e51bd571620d16077a7a6f94542590e9ba4be88b356a07372b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.2-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 178f422cce633290e08bef551c9d2fafa4c6987cc006d970289795eca5f54d7a
MD5 9bfb0f1f0e6851e953e0d3e629883cae
BLAKE2b-256 ec5c52e65032ddd81714bb01ca81f0f4e531059230b30fa12416973ead1c8f8a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysrat-0.2.2-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.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 060e96132309b806f6e036a3c1327ffc22eeec7af2d5ad880a961a4c1cc1541f
MD5 03dd25c8d878f864d73dc7bd4d022156
BLAKE2b-256 99bfb7b5dda41999009ce1bb48d0001128cb507728aa444cb63e5e56e0dcdb62

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 419964d36d6c070ebe927625ec5ac95e14a270408dc2b6c42de062d49593d154
MD5 c30c4a4a35de5d40a57a5aade158af9b
BLAKE2b-256 e09be84ac396745cdfd94f99aa71ae8efdd17f66dab97c0a592634865d0bff37

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8d51fa350c6b334a4b5e38bf954ea23e3c2b9ad8921ff74a00bf5a1065ee0b84
MD5 266af59276010d726e5274a7c03be7bb
BLAKE2b-256 c27bce2fc39dfa14fdee15a0c9fd35e569e06a45a43c6401ac7167c409e794aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 978bf3c452284c8f519728b06296ea21e9528506f52162067f22aad2af5e71df
MD5 26af9b6ed37d861e653485dc95d7342a
BLAKE2b-256 cd7328de3c839c6d06b198be8005eec495e068a34b5cdad7c44d904069c8e68b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysrat-0.2.2-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.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 6458ed7661af5bff2920013765b0bd9c2872083384312e91f3025974ab95006d
MD5 efb6f29a37fff8621fd2e2bf1e29b455
BLAKE2b-256 037d51cc6f48f46246c9357c621b9ed01bb6099a6242d3f8687269ab1e55a463

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6b2c2250ee0f0dee971d93221251f3866ef2dbf8aff5c189ef2d52dbd2e45153
MD5 542bcb054e6c1c466dbed2efa9641799
BLAKE2b-256 fabd590efa4acc1fa819dbc23cd043a564cec7a48e8fd5fc40b29fc4207bb340

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a91d82467378d9823d1aff8f2dd80ff87b0190340b9281f527188953309f487f
MD5 7f3cf11ef2bfec9a60cb496f1bf200b2
BLAKE2b-256 30d2a06c3495195cf66afb3f0d6ea5fbe5013c5012fbd93232a56238a94ec716

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8d8bb006a46c0652708c6a2eff4c9d30766a3f464075c9ee76cf041f6c9e9dcc
MD5 d087b4c9a0f74721dfe0c0f52d77e05c
BLAKE2b-256 18bf6000b93a67cdf7eac7d5e06d67e893aabe7e4b6ec9f7d3298a92eb6d0da7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysrat-0.2.2-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.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f7a5bd113031e45e2a870cc5b23971c82b63683ddde1052dd554d6e33ad2af2b
MD5 6852a60ab698e320f3e731d9d0e4b2d5
BLAKE2b-256 6eefe17c633c7ca4362efaae0dc2875895dc1722a4306202af8d9b2042a39ca0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 19b74720ad862aeaad2740ac658016d662ac6d06469bdd123bb4eb50d1a64787
MD5 c35945360b13d3998520133e88a4040b
BLAKE2b-256 de105fef18179014b8dd8cb0d0291d80313e7eb82ba279dc981ad2065eb40c29

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 363731c34c8a13cc8a6a808a11fba4b83f2673ec8abc3a9ba59968b63f10406d
MD5 6d5ffe9d543b2c8d330f22476c6db707
BLAKE2b-256 e5c04db167577818ab4e5e9d3c68233264305a3144a0545f446e082a321f3b0e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pysrat-0.2.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5599096c9b6feb1ba11b5d74bd6b770f33f4409d99ffa2735940d6bbded73e00
MD5 2c08526a9a6cf092f80aae21c3c920ed
BLAKE2b-256 953307bda117f0203cd9fda91e13f2b179c1f570c084de3054c8437c295bdb80

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