.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/reliability/plot_reliability_benchmark.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via JupyterLite. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_reliability_plot_reliability_benchmark.py: Redundancy under independent failures ===================================== Two independent components provide a simple comparison of series and parallel architectures. At the component half-life, the series system survives with probability one quarter and the parallel system with probability three quarters. .. GENERATED FROM PYTHON SOURCE LINES 9-30 .. image-sg:: /api/gallery/reliability/images/sphx_glr_plot_reliability_benchmark_001.png :alt: plot reliability benchmark :srcset: /api/gallery/reliability/images/sphx_glr_plot_reliability_benchmark_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from engineeringkit.reliability import exponential_reliability, parallel_reliability, series_reliability lam = 0.001 t = np.linspace(0, 5000, 201) r = exponential_reliability(t, lam) series = np.array([series_reliability(ri, ri) for ri in r]) parallel = np.array([parallel_reliability(ri, ri) for ri in r]) assert np.isclose(series_reliability(0.5, 0.5), 0.25) assert np.isclose(parallel_reliability(0.5, 0.5), 0.75) assert np.all(series <= r) and np.all(r <= parallel) fig, ax = plt.subplots() for values, label in [(r, "one component"), (series, "series"), (parallel, "parallel")]: ax.plot(t, values, label=label) ax.set(xlabel="mission time [h]", ylabel="survival probability") ax.legend() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.079 seconds) .. _sphx_glr_download_api_gallery_reliability_plot_reliability_benchmark.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: lite-badge .. image:: images/jupyterlite_badge_logo.svg :target: ../../../lite/lab/index.html?path=api/gallery/reliability/plot_reliability_benchmark.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_reliability_benchmark.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_reliability_benchmark.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_reliability_benchmark.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_