Skip to main content
Loss of provenance

A previous release had provenance metadata, but this release does not. View details.

Tests

sensitivities

(L. Riegger, 2025)

Methods for linear and stochastic sensitivities analysis and uncertainty propagation, following the BIPM GUM (JCGM 102:2011).

Install

You can install the sensitivities module using pip:

pip install sensitivities

Usage

sensitivities.stochastic

The sensitivities.stochastic module provides functionality for stochastic sensitivity analysis. It allows you to stochastically sample input parameters from various, potentially correlated distributions and evaluate the sensitivities of a function to those inputs. Available distributions are

  • Gaussian (given mean and standard deviation)
  • Uniform (between lower and upper bound)
  • Discrete (multiple discrete options)

Example for stochastic sampling:

from sensitivities.stochastic import sample, Gaussian, Uniform, Discrete
import matplotlib.pyplot as plt

def my_function(a, b, c=0, d=0):
    return a + b + c + d


samples = sample(
    my_function,
    [
        Gaussian(10, 0.05),
        Discrete([1, 2]),
    ],
    {"c": Uniform(-0.4, 0.4), "d": -100},
    corr=[("a", "c", 0.5)],
    n=100000,
)

plt.hist(np.array(samples), 100)
plt.show()

sensitivities.linear

This module contains the propagate_uncertainties function for propagation of uncertainties for a given function based on the principle of linear differentials. It makes use of the scipy function approx_fprime to calculate the partial derivatives of the given function.

Here is a simple usage example:

from sensitivities.linear import propagate_uncertainties

def my_function(x, y):
    return [x ** 2, x, y]

print(propagate_uncertainties(my_function, uncertainties=[0.1, 0.2], x0=[1, 1]))

This will output the propagated standard uncertainties and correlation matrix between the function outputs:

(
    np.array([0.2, 0.1, 0.2]),
    np.array([[1.0, 1.0, 0.0], [1.0, 1.0, 0.0], [0.0, 0.0, 1.0]])
)

Development

Setup development environment

uv sync --extra dev

Metadata

Release files for sensitivities 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Loss of provenance

These files do not have provenance metadata, despite files in a prior release including this data.

We recommend further investigation before installing these files. View details.

Source distribution (sdist)

Source distribution for sensitivities 1.2.0
File Size Uploaded Provenance Actions
sensitivities-1.2.0.tar.gz 587.5 kB Without provenance Details for sensitivities-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sensitivities 1.2.0
File Interpreter ABI Platform Actions
sensitivities-1.2.0-py3-none-any.whl Python 3 none any Details for sensitivities-1.2.0-py3-none-any.whl

Total release size: 597.7 kB

Release files / sensitivities-1.2.0.tar.gz

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL sensitivities-1.2.0.tar.gz
Size 587.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0145404b2fdd40cacb386fea0a327a4086d01f1f843b090c54c7745222442e56
BLAKE2b-256 checksum
How to use checksums
7864d6f27e349e195c72981fa9ec6648e337775591b34567792e856701844f44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.6.14

Release files / sensitivities-1.2.0-py3-none-any.whl

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL sensitivities-1.2.0-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d4a4ad3e9d4ad8679d8eebb50d23a5de222c44fb8a03ea2958aba5a718b45df
BLAKE2b-256 checksum
How to use checksums
fbfb7444b2735282ea00dfd61abd129605760e79aa08e11b25b26d27e743835d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.6.14

Security for sensitivities 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Loss of provenance

A previous release of these files had provenance metadata, but this release does not.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Release comparison

  • Removed 1.1.0 2 files With provenance
  • Added 1.2.0 2 files Without provenance

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page