pysrat 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pysrat-0.1.0/.github/workflows/release.yml +83 -0
- pysrat-0.1.0/.gitignore +37 -0
- pysrat-0.1.0/CMakeLists.txt +57 -0
- pysrat-0.1.0/LICENSE +21 -0
- pysrat-0.1.0/PKG-INFO +168 -0
- pysrat-0.1.0/README.md +128 -0
- pysrat-0.1.0/csrc/basic/basic_pybind.cpp +292 -0
- pysrat-0.1.0/csrc/basic/em_exp.cpp +125 -0
- pysrat-0.1.0/csrc/basic/em_gamma.cpp +226 -0
- pysrat-0.1.0/csrc/basic/em_llogis.cpp +315 -0
- pysrat-0.1.0/csrc/basic/em_lnorm.cpp +183 -0
- pysrat-0.1.0/csrc/basic/em_pareto.cpp +183 -0
- pysrat-0.1.0/csrc/basic/em_tlogis.cpp +308 -0
- pysrat-0.1.0/csrc/basic/em_tnorm.cpp +164 -0
- pysrat-0.1.0/csrc/basic/em_txvmax.cpp +327 -0
- pysrat-0.1.0/csrc/basic/gumbel.cpp +89 -0
- pysrat-0.1.0/csrc/basic/gumbel.h +18 -0
- pysrat-0.1.0/csrc/basic/lxvmax.cpp +150 -0
- pysrat-0.1.0/csrc/basic/lxvmin.cpp +150 -0
- pysrat-0.1.0/csrc/basic/txvmin.cpp +149 -0
- pysrat-0.1.0/csrc/cf1/blas1_span.h +73 -0
- pysrat-0.1.0/csrc/cf1/blas2_span.h +113 -0
- pysrat-0.1.0/csrc/cf1/cf1_pybind.cpp +510 -0
- pysrat-0.1.0/csrc/cf1/cf1utils_span.h +443 -0
- pysrat-0.1.0/csrc/cf1/mexp.h +149 -0
- pysrat-0.1.0/csrc/cf1/mexp_span.h +169 -0
- pysrat-0.1.0/csrc/cf1/poisson.cpp +81 -0
- pysrat-0.1.0/csrc/cf1/poisson.h +144 -0
- pysrat-0.1.0/csrc/utils/gauss_inte.c +117 -0
- pysrat-0.1.0/csrc/utils/gauss_inte.h +20 -0
- pysrat-0.1.0/csrc/utils/inv_log_psi.c +48 -0
- pysrat-0.1.0/csrc/utils/inv_log_psi.h +18 -0
- pysrat-0.1.0/csrc/utils/logistic.c +50 -0
- pysrat-0.1.0/csrc/utils/logistic.h +22 -0
- pysrat-0.1.0/csrc/utils/norm.c +26 -0
- pysrat-0.1.0/csrc/utils/norm.h +20 -0
- pysrat-0.1.0/csrc/utils/numlib.c +229 -0
- pysrat-0.1.0/csrc/utils/numlib.h +43 -0
- pysrat-0.1.0/docs/models.md +108 -0
- pysrat-0.1.0/examples/exampl1.ipynb +200 -0
- pysrat-0.1.0/examples/exampl2.ipynb +261 -0
- pysrat-0.1.0/pyproject.toml +41 -0
- pysrat-0.1.0/src/pysrat/__init__.py +7 -0
- pysrat-0.1.0/src/pysrat/nhpp/__init__.py +28 -0
- pysrat-0.1.0/src/pysrat/nhpp/_em.py +156 -0
- pysrat-0.1.0/src/pysrat/nhpp/_version.py +1 -0
- pysrat-0.1.0/src/pysrat/nhpp/base.py +124 -0
- pysrat-0.1.0/src/pysrat/nhpp/bootstrap.py +200 -0
- pysrat-0.1.0/src/pysrat/nhpp/data.py +116 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/.gitkeep +0 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/ss1a.csv +114 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/ss1ag.csv +152 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/ss1b.csv +377 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/ss1bg.csv +664 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/ss1c.csv +279 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/ss1cg.csv +473 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/ss2.csv +194 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/ss2g.csv +666 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/ss3.csv +280 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/ss3g.csv +666 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/ss4.csv +198 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/ss4g.csv +636 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/sys1.csv +138 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/sys14c.csv +38 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/sys14cg.csv +193 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/sys17.csv +40 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/sys17g.csv +65 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/sys1g.csv +97 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/sys2.csv +56 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/sys27.csv +43 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/sys27g.csv +97 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/sys2g.csv +75 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/sys3.csv +40 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/sys3g.csv +57 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/sys4.csv +55 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/sys40.csv +103 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/sys40g.csv +365 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/sys4g.csv +73 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/sys5.csv +833 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/sys5g.csv +433 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/sys6.csv +75 -0
- pysrat-0.1.0/src/pysrat/nhpp/datasets/musa/sys6g.csv +65 -0
- pysrat-0.1.0/src/pysrat/nhpp/dists/__init__.py +61 -0
- pysrat-0.1.0/src/pysrat/nhpp/dists/cf1.py +232 -0
- pysrat-0.1.0/src/pysrat/nhpp/dists/exp.py +74 -0
- pysrat-0.1.0/src/pysrat/nhpp/dists/gamma.py +87 -0
- pysrat-0.1.0/src/pysrat/nhpp/dists/gumbel.py +77 -0
- pysrat-0.1.0/src/pysrat/nhpp/dists/lgumbel.py +89 -0
- pysrat-0.1.0/src/pysrat/nhpp/dists/llogis.py +87 -0
- pysrat-0.1.0/src/pysrat/nhpp/dists/lnorm.py +81 -0
- pysrat-0.1.0/src/pysrat/nhpp/dists/pareto2.py +81 -0
- pysrat-0.1.0/src/pysrat/nhpp/dists/tgumbel.py +84 -0
- pysrat-0.1.0/src/pysrat/nhpp/dists/tlogis.py +84 -0
- pysrat-0.1.0/src/pysrat/nhpp/dists/tnorm.py +92 -0
- pysrat-0.1.0/src/pysrat/nhpp/fit.py +13 -0
- pysrat-0.1.0/src/pysrat/nhpp/models/_utils.py +38 -0
- pysrat-0.1.0/src/pysrat/nhpp/models/cf1.py +128 -0
- pysrat-0.1.0/src/pysrat/nhpp/models/exp.py +48 -0
- pysrat-0.1.0/src/pysrat/nhpp/models/gamma.py +47 -0
- pysrat-0.1.0/src/pysrat/nhpp/models/llogis.py +64 -0
- pysrat-0.1.0/src/pysrat/nhpp/models/lnorm.py +45 -0
- pysrat-0.1.0/src/pysrat/nhpp/models/lxvmax.py +64 -0
- pysrat-0.1.0/src/pysrat/nhpp/models/lxvmin.py +64 -0
- pysrat-0.1.0/src/pysrat/nhpp/models/pareto2.py +50 -0
- pysrat-0.1.0/src/pysrat/nhpp/models/tlogis.py +65 -0
- pysrat-0.1.0/src/pysrat/nhpp/models/tnorm.py +45 -0
- pysrat-0.1.0/src/pysrat/nhpp/models/txvmax.py +65 -0
- pysrat-0.1.0/src/pysrat/nhpp/models/txvmin.py +65 -0
- pysrat-0.1.0/src/pysrat/nhpp/options.py +14 -0
- pysrat-0.1.0/src/pysrat/nhpp/plot.py +142 -0
- pysrat-0.1.0/tests/test_cf1.py +45 -0
- pysrat-0.1.0/tests/test_cf1_impl.py +98 -0
- pysrat-0.1.0/tests/test_data.py +13 -0
- pysrat-0.1.0/tests/test_datasets.py +33 -0
- pysrat-0.1.0/tests/test_dists.py +220 -0
- pysrat-0.1.0/tests/test_eic.py +50 -0
- pysrat-0.1.0/tests/test_emstep.py +85 -0
- pysrat-0.1.0/tests/test_exp.py +23 -0
- pysrat-0.1.0/tests/test_llogis.py +29 -0
- pysrat-0.1.0/tests/test_lnorm.py +29 -0
- pysrat-0.1.0/tests/test_lxvmax.py +13 -0
- pysrat-0.1.0/tests/test_lxvmin.py +13 -0
- pysrat-0.1.0/tests/test_pareto2.py +17 -0
- pysrat-0.1.0/tests/test_tlogis.py +29 -0
- pysrat-0.1.0/tests/test_tnorm.py +29 -0
- pysrat-0.1.0/tests/test_txvmax.py +13 -0
- pysrat-0.1.0/tests/test_txvmin.py +13 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build-wheels:
|
|
10
|
+
name: Build wheels (${{ matrix.os }})
|
|
11
|
+
runs-on: ${{ matrix.os }}
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
matrix:
|
|
15
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.11"
|
|
22
|
+
|
|
23
|
+
- name: Build wheels
|
|
24
|
+
uses: pypa/cibuildwheel@v2.21.2
|
|
25
|
+
env:
|
|
26
|
+
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-*"
|
|
27
|
+
CIBW_SKIP: "pp* *musllinux*"
|
|
28
|
+
CIBW_ARCHS_LINUX: "x86_64"
|
|
29
|
+
CIBW_ARCHS_MACOS: "x86_64 arm64"
|
|
30
|
+
CIBW_ARCHS_WINDOWS: "AMD64"
|
|
31
|
+
CIBW_TEST_COMMAND: "python -c \"import pysrat; print('import ok')\""
|
|
32
|
+
CIBW_TEST_SKIP: "*"
|
|
33
|
+
CIBW_BUILD_FRONTEND: "build"
|
|
34
|
+
CIBW_BUILD_VERBOSITY: "1"
|
|
35
|
+
|
|
36
|
+
- name: Upload wheels
|
|
37
|
+
uses: actions/upload-artifact@v4
|
|
38
|
+
with:
|
|
39
|
+
name: wheels-${{ matrix.os }}
|
|
40
|
+
path: wheelhouse/*.whl
|
|
41
|
+
|
|
42
|
+
build-sdist:
|
|
43
|
+
name: Build sdist
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
steps:
|
|
46
|
+
- uses: actions/checkout@v4
|
|
47
|
+
|
|
48
|
+
- uses: actions/setup-python@v5
|
|
49
|
+
with:
|
|
50
|
+
python-version: "3.11"
|
|
51
|
+
|
|
52
|
+
- name: Build sdist
|
|
53
|
+
run: python -m build --sdist
|
|
54
|
+
|
|
55
|
+
- name: Upload sdist
|
|
56
|
+
uses: actions/upload-artifact@v4
|
|
57
|
+
with:
|
|
58
|
+
name: sdist
|
|
59
|
+
path: dist/*.tar.gz
|
|
60
|
+
|
|
61
|
+
publish:
|
|
62
|
+
name: Publish to PyPI
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
needs: [build-wheels, build-sdist]
|
|
65
|
+
permissions:
|
|
66
|
+
contents: read
|
|
67
|
+
id-token: write
|
|
68
|
+
steps:
|
|
69
|
+
- uses: actions/download-artifact@v4
|
|
70
|
+
with:
|
|
71
|
+
pattern: wheels-*
|
|
72
|
+
merge-multiple: true
|
|
73
|
+
path: dist
|
|
74
|
+
|
|
75
|
+
- uses: actions/download-artifact@v4
|
|
76
|
+
with:
|
|
77
|
+
name: sdist
|
|
78
|
+
path: dist
|
|
79
|
+
|
|
80
|
+
- name: Publish
|
|
81
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
82
|
+
with:
|
|
83
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
pysrat-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
*.dylib
|
|
7
|
+
*.pyd
|
|
8
|
+
|
|
9
|
+
# Virtual environments
|
|
10
|
+
.venv/
|
|
11
|
+
venv/
|
|
12
|
+
ENV/
|
|
13
|
+
|
|
14
|
+
# Build artifacts
|
|
15
|
+
build/
|
|
16
|
+
dist/
|
|
17
|
+
*.egg-info/
|
|
18
|
+
*.egg
|
|
19
|
+
|
|
20
|
+
# CMake
|
|
21
|
+
CMakeFiles/
|
|
22
|
+
CMakeCache.txt
|
|
23
|
+
cmake_install.cmake
|
|
24
|
+
Makefile
|
|
25
|
+
|
|
26
|
+
# Tests/coverage
|
|
27
|
+
.pytest_cache/
|
|
28
|
+
.coverage
|
|
29
|
+
htmlcov/
|
|
30
|
+
|
|
31
|
+
# IDE/editor
|
|
32
|
+
.vscode/
|
|
33
|
+
.idea/
|
|
34
|
+
.DS_Store
|
|
35
|
+
|
|
36
|
+
# Logs
|
|
37
|
+
*.log
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.18)
|
|
2
|
+
project(pysrat LANGUAGES C CXX)
|
|
3
|
+
|
|
4
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
5
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
6
|
+
|
|
7
|
+
find_package(Python COMPONENTS Interpreter Development REQUIRED)
|
|
8
|
+
find_package(pybind11 CONFIG REQUIRED)
|
|
9
|
+
|
|
10
|
+
# C core (bundled for convenience)
|
|
11
|
+
add_library(srat_core STATIC
|
|
12
|
+
csrc/utils/numlib.c
|
|
13
|
+
csrc/utils/inv_log_psi.c
|
|
14
|
+
csrc/utils/gauss_inte.c
|
|
15
|
+
csrc/utils/logistic.c
|
|
16
|
+
csrc/utils/norm.c
|
|
17
|
+
)
|
|
18
|
+
target_include_directories(srat_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/csrc/utils)
|
|
19
|
+
|
|
20
|
+
# Python extension module
|
|
21
|
+
pybind11_add_module(_core
|
|
22
|
+
csrc/basic/basic_pybind.cpp
|
|
23
|
+
csrc/basic/em_exp.cpp
|
|
24
|
+
csrc/basic/em_tnorm.cpp
|
|
25
|
+
csrc/basic/em_pareto.cpp
|
|
26
|
+
csrc/basic/em_lnorm.cpp
|
|
27
|
+
csrc/basic/em_tlogis.cpp
|
|
28
|
+
csrc/basic/em_llogis.cpp
|
|
29
|
+
csrc/basic/em_gamma.cpp
|
|
30
|
+
csrc/basic/em_txvmax.cpp
|
|
31
|
+
csrc/basic/gumbel.cpp
|
|
32
|
+
csrc/basic/txvmin.cpp
|
|
33
|
+
csrc/basic/lxvmax.cpp
|
|
34
|
+
csrc/basic/lxvmin.cpp
|
|
35
|
+
)
|
|
36
|
+
target_link_libraries(_core PRIVATE srat_core Python::Python)
|
|
37
|
+
target_include_directories(_core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/csrc/utils)
|
|
38
|
+
|
|
39
|
+
# CF1 span backend module (C++20)
|
|
40
|
+
pybind11_add_module(marlib_cf1
|
|
41
|
+
csrc/cf1/cf1_pybind.cpp
|
|
42
|
+
csrc/cf1/poisson.cpp
|
|
43
|
+
)
|
|
44
|
+
target_compile_features(marlib_cf1 PRIVATE cxx_std_20)
|
|
45
|
+
target_include_directories(marlib_cf1 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/csrc/cf1)
|
|
46
|
+
|
|
47
|
+
install(TARGETS _core
|
|
48
|
+
LIBRARY DESTINATION pysrat
|
|
49
|
+
ARCHIVE DESTINATION pysrat
|
|
50
|
+
RUNTIME DESTINATION pysrat
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
install(TARGETS marlib_cf1
|
|
54
|
+
LIBRARY DESTINATION pysrat
|
|
55
|
+
ARCHIVE DESTINATION pysrat
|
|
56
|
+
RUNTIME DESTINATION pysrat
|
|
57
|
+
)
|
pysrat-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hiroyuki Okamura
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
pysrat-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: pysrat
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python package for software reliability analysis and modeling
|
|
5
|
+
Author-Email: Hiroyuki Okamura <okamu@hiroshima-u.ac.jp>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Hiroyuki Okamura
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Requires-Python: >=3.9
|
|
29
|
+
Requires-Dist: numpy>=1.23
|
|
30
|
+
Requires-Dist: scipy>=1.9
|
|
31
|
+
Requires-Dist: matplotlib>=3.7
|
|
32
|
+
Requires-Dist: tqdm>=4.66
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
35
|
+
Requires-Dist: pandas>=2.0; extra == "dev"
|
|
36
|
+
Requires-Dist: tqdm>=4.66; extra == "dev"
|
|
37
|
+
Requires-Dist: build; extra == "dev"
|
|
38
|
+
Requires-Dist: twine; extra == "dev"
|
|
39
|
+
Description-Content-Type: text/markdown
|
|
40
|
+
|
|
41
|
+
# pysrat
|
|
42
|
+
|
|
43
|
+
Python implementation of NHPP (non-homogeneous Poisson process) software reliability models with a C/pybind11 core and a Pythonic estimator API.
|
|
44
|
+
|
|
45
|
+
## Features
|
|
46
|
+
|
|
47
|
+
- Scikit-learn–style estimators: `model.fit(data)` and `params_`/`llf_`/`aic_`
|
|
48
|
+
- NHPP data helpers: `NHPPData.from_intervals(...)`, `from_counts(...)`, `from_fault_times(...)`
|
|
49
|
+
- Fast EM updates in C via pybind11
|
|
50
|
+
- CF1 (canonical phase-type) NHPP model and distribution helpers
|
|
51
|
+
- Simple plotting helpers (`plot_mvf`, `plot_dmvf`, `plot_rate`)
|
|
52
|
+
|
|
53
|
+
## Installation
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
python -m pip install -U pip
|
|
57
|
+
pip install -e .
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Notes:
|
|
61
|
+
- A C++20-capable compiler is required to build the CF1 extension module.
|
|
62
|
+
|
|
63
|
+
## Quick start
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
import numpy as np
|
|
67
|
+
from pysrat import NHPPData, ExponentialNHPP, plot_mvf
|
|
68
|
+
|
|
69
|
+
data = NHPPData.from_intervals(time=[1, 1, 1, 1], fault=[0, 1, 0, 5])
|
|
70
|
+
|
|
71
|
+
model = ExponentialNHPP().fit(data)
|
|
72
|
+
print(model.params_)
|
|
73
|
+
print(model.aic_)
|
|
74
|
+
|
|
75
|
+
plot_mvf(data, model)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
CF1 example:
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
import numpy as np
|
|
82
|
+
from pysrat import NHPPData
|
|
83
|
+
from pysrat.models.cf1 import CanonicalPhaseTypeNHPP
|
|
84
|
+
|
|
85
|
+
data = NHPPData.from_intervals(time=[1, 2, 1.5], fault=[1, 0, 2], type=[0, 1, 0])
|
|
86
|
+
model = CanonicalPhaseTypeNHPP(3).fit(data)
|
|
87
|
+
print(model.params_)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## API overview
|
|
91
|
+
|
|
92
|
+
### Data
|
|
93
|
+
|
|
94
|
+
- `NHPPData.from_intervals(time=..., fault=..., type=..., te=...)`
|
|
95
|
+
- `NHPPData.from_counts(fault=...)`
|
|
96
|
+
- `NHPPData.from_fault_times(times=..., te=...)`
|
|
97
|
+
|
|
98
|
+
### Models
|
|
99
|
+
|
|
100
|
+
- `ExponentialNHPP` (exponential)
|
|
101
|
+
- `TruncatedNormalNHPP`, `Pareto2NHPP`, `GammaNHPP`, `LogNormalNHPP`
|
|
102
|
+
- `TruncatedLogisticNHPP`, `LogLogisticNHPP`
|
|
103
|
+
- `TruncatedExtremeValueMaxNHPP`, `LogExtremeValueMaxNHPP`
|
|
104
|
+
- `TruncatedExtremeValueMinNHPP`, `LogExtremeValueMinNHPP`
|
|
105
|
+
- `CanonicalPhaseTypeNHPP` (CF1)
|
|
106
|
+
|
|
107
|
+
### Model comparison
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
from pysrat import compare, ExponentialNHPP, NHPPData
|
|
111
|
+
|
|
112
|
+
data = NHPPData.from_counts([0, 1, 0, 5])
|
|
113
|
+
fitted, best = compare([ExponentialNHPP()], data, criterion="AIC")
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Distributions
|
|
117
|
+
|
|
118
|
+
R-like helpers live under `pysrat.dists`, e.g.:
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
from pysrat.dists import dcf1, pcf1, rcf1
|
|
122
|
+
|
|
123
|
+
alpha = [0.4, 0.3, 0.3]
|
|
124
|
+
rate = [0.5, 1.0, 1.5]
|
|
125
|
+
print(dcf1([0.1, 0.5], alpha=alpha, rate=rate))
|
|
126
|
+
print(pcf1([0.1, 0.5], alpha=alpha, rate=rate))
|
|
127
|
+
print(rcf1(5, alpha=alpha, rate=rate))
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Plotting
|
|
131
|
+
|
|
132
|
+
- `plot_mvf(data, model_or_results)`
|
|
133
|
+
- `plot_dmvf(data, model_or_results)`
|
|
134
|
+
- `plot_rate(data, model_or_results)`
|
|
135
|
+
|
|
136
|
+
Note: Only the `plot_*` functions above are exported; legacy aliases like `mvfplot`, `dmvfplot`, and `rateplot` are not provided.
|
|
137
|
+
|
|
138
|
+
`model_or_results` can be an `NHPPModel`, a `dict[str, NHPPModel]`, or a list of models.
|
|
139
|
+
|
|
140
|
+
### Hyperparameters
|
|
141
|
+
|
|
142
|
+
Models expose sklearn-style hyperparameters via `get_params()`/`set_params()`. For example:
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
model = ExponentialNHPP(omega0=1.0, rate0=1.0)
|
|
146
|
+
model.set_params(rate0=0.5)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Development
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
python -m pip install -U pip
|
|
153
|
+
pip install -e .[dev]
|
|
154
|
+
pytest -q
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Release
|
|
158
|
+
|
|
159
|
+
Tag and push to trigger the PyPI release workflow:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
git tag v0.1.0
|
|
163
|
+
git push --tags
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Set either:
|
|
167
|
+
- `PYPI_API_TOKEN` secret for token-based upload, or
|
|
168
|
+
- Trusted Publishing (OIDC) in PyPI and keep the workflow permissions as-is.
|
pysrat-0.1.0/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# pysrat
|
|
2
|
+
|
|
3
|
+
Python implementation of NHPP (non-homogeneous Poisson process) software reliability models with a C/pybind11 core and a Pythonic estimator API.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Scikit-learn–style estimators: `model.fit(data)` and `params_`/`llf_`/`aic_`
|
|
8
|
+
- NHPP data helpers: `NHPPData.from_intervals(...)`, `from_counts(...)`, `from_fault_times(...)`
|
|
9
|
+
- Fast EM updates in C via pybind11
|
|
10
|
+
- CF1 (canonical phase-type) NHPP model and distribution helpers
|
|
11
|
+
- Simple plotting helpers (`plot_mvf`, `plot_dmvf`, `plot_rate`)
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
python -m pip install -U pip
|
|
17
|
+
pip install -e .
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Notes:
|
|
21
|
+
- A C++20-capable compiler is required to build the CF1 extension module.
|
|
22
|
+
|
|
23
|
+
## Quick start
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
import numpy as np
|
|
27
|
+
from pysrat import NHPPData, ExponentialNHPP, plot_mvf
|
|
28
|
+
|
|
29
|
+
data = NHPPData.from_intervals(time=[1, 1, 1, 1], fault=[0, 1, 0, 5])
|
|
30
|
+
|
|
31
|
+
model = ExponentialNHPP().fit(data)
|
|
32
|
+
print(model.params_)
|
|
33
|
+
print(model.aic_)
|
|
34
|
+
|
|
35
|
+
plot_mvf(data, model)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
CF1 example:
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
import numpy as np
|
|
42
|
+
from pysrat import NHPPData
|
|
43
|
+
from pysrat.models.cf1 import CanonicalPhaseTypeNHPP
|
|
44
|
+
|
|
45
|
+
data = NHPPData.from_intervals(time=[1, 2, 1.5], fault=[1, 0, 2], type=[0, 1, 0])
|
|
46
|
+
model = CanonicalPhaseTypeNHPP(3).fit(data)
|
|
47
|
+
print(model.params_)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## API overview
|
|
51
|
+
|
|
52
|
+
### Data
|
|
53
|
+
|
|
54
|
+
- `NHPPData.from_intervals(time=..., fault=..., type=..., te=...)`
|
|
55
|
+
- `NHPPData.from_counts(fault=...)`
|
|
56
|
+
- `NHPPData.from_fault_times(times=..., te=...)`
|
|
57
|
+
|
|
58
|
+
### Models
|
|
59
|
+
|
|
60
|
+
- `ExponentialNHPP` (exponential)
|
|
61
|
+
- `TruncatedNormalNHPP`, `Pareto2NHPP`, `GammaNHPP`, `LogNormalNHPP`
|
|
62
|
+
- `TruncatedLogisticNHPP`, `LogLogisticNHPP`
|
|
63
|
+
- `TruncatedExtremeValueMaxNHPP`, `LogExtremeValueMaxNHPP`
|
|
64
|
+
- `TruncatedExtremeValueMinNHPP`, `LogExtremeValueMinNHPP`
|
|
65
|
+
- `CanonicalPhaseTypeNHPP` (CF1)
|
|
66
|
+
|
|
67
|
+
### Model comparison
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from pysrat import compare, ExponentialNHPP, NHPPData
|
|
71
|
+
|
|
72
|
+
data = NHPPData.from_counts([0, 1, 0, 5])
|
|
73
|
+
fitted, best = compare([ExponentialNHPP()], data, criterion="AIC")
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Distributions
|
|
77
|
+
|
|
78
|
+
R-like helpers live under `pysrat.dists`, e.g.:
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from pysrat.dists import dcf1, pcf1, rcf1
|
|
82
|
+
|
|
83
|
+
alpha = [0.4, 0.3, 0.3]
|
|
84
|
+
rate = [0.5, 1.0, 1.5]
|
|
85
|
+
print(dcf1([0.1, 0.5], alpha=alpha, rate=rate))
|
|
86
|
+
print(pcf1([0.1, 0.5], alpha=alpha, rate=rate))
|
|
87
|
+
print(rcf1(5, alpha=alpha, rate=rate))
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Plotting
|
|
91
|
+
|
|
92
|
+
- `plot_mvf(data, model_or_results)`
|
|
93
|
+
- `plot_dmvf(data, model_or_results)`
|
|
94
|
+
- `plot_rate(data, model_or_results)`
|
|
95
|
+
|
|
96
|
+
Note: Only the `plot_*` functions above are exported; legacy aliases like `mvfplot`, `dmvfplot`, and `rateplot` are not provided.
|
|
97
|
+
|
|
98
|
+
`model_or_results` can be an `NHPPModel`, a `dict[str, NHPPModel]`, or a list of models.
|
|
99
|
+
|
|
100
|
+
### Hyperparameters
|
|
101
|
+
|
|
102
|
+
Models expose sklearn-style hyperparameters via `get_params()`/`set_params()`. For example:
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
model = ExponentialNHPP(omega0=1.0, rate0=1.0)
|
|
106
|
+
model.set_params(rate0=0.5)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Development
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
python -m pip install -U pip
|
|
113
|
+
pip install -e .[dev]
|
|
114
|
+
pytest -q
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Release
|
|
118
|
+
|
|
119
|
+
Tag and push to trigger the PyPI release workflow:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
git tag v0.1.0
|
|
123
|
+
git push --tags
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Set either:
|
|
127
|
+
- `PYPI_API_TOKEN` secret for token-based upload, or
|
|
128
|
+
- Trusted Publishing (OIDC) in PyPI and keep the workflow permissions as-is.
|