StressPy
Core numerical routines for the Geometric Stress Criterion (GSC).
stresspy decomposes a model--data discrepancy into a component aligned with
the model's local parameter-accessible tangent space and a component normal to
that space. It also reports numerical rank, singular values, the normal
fraction, conditioning and a minimum-norm local repair vector.
StressPy is an early reference implementation. It performs the deterministic geometric calculation; it does not yet fit models, construct ODE Jacobians or perform bootstrap calibration.
Installation
pip install stresspy
Quick example
import numpy as np
from stresspy import decompose
observed = np.array([1.1, 1.9, 0.9])
predicted = np.array([1.0, 2.0, 1.0])
jacobian = np.array([
[1.0, 0.0],
[1.0, 1.0],
[0.0, 1.0],
])
sigma = np.array([0.1, 0.1, 0.1])
result = decompose(
observed=observed,
predicted=predicted,
jacobian=jacobian,
sigma=sigma,
)
print("Tangent stress:", result.tangent_stress)
print("Normal stress:", result.normal_stress)
print("Normal fraction (%):", result.normal_fraction_pct)
print("Numerical rank:", result.rank)
print("Repair vector:", result.repair_vector)
The discrepancy convention is
[ r = y - f(\hat{\theta}). ]
With observation-space whitening matrix (L), StressPy forms (r_W=Lr) and (J_W=LJ). If (U_r) contains the retained left singular vectors of (J_W), then
[ r_{\parallel,W}=U_rU_r^\top r_W, \qquad r_{\perp,W}=r_W-r_{\parallel,W}. ]
The squared norms give total, tangent and normal stress. The minimum-norm local repair is calculated in the parameter coordinates represented by the supplied Jacobian. Consequently, repair magnitude is coordinate-dependent, and local tangent accessibility does not guarantee a practical finite nonlinear repair.
Principal functions
decompose: single tangent--normal decomposition with optional uncertainty or covariance weighting.decompose_blocks: joint interrogation of multiple independent observation blocks sharing the same parameter coordinates.floor_sigma: explicit uncertainty-floor preprocessing.jacobian_to_log_coordinates: conversion of selected Jacobian columns to log-parameter coordinates.
decompose returns an immutable GSCResult containing the component vectors,
stress measures, normal fraction, numerical-rank diagnostics and local repair.
Interpretation
Normal stress measures discrepancy outside the retained local Jacobian column space in the selected observation metric. It is a local geometric diagnostic, not by itself a calibrated hypothesis test. Conclusions can depend on the chosen weighting, parameter point and singular-value threshold.
Licence and commercial use
StressPy is available under the PolyForm Noncommercial License 1.0.0. It may be used, studied, modified and redistributed for permitted non-commercial purposes under those terms. Commercial use requires separate written permission from the copyright holder.
Citation
If StressPy contributes to academic work, please cite the software and the
associated GSC publication when available. Citation metadata is provided in
CITATION.cff.
Suggested software citation:
James, D. (2026). StressPy: Core numerical routines for the Geometric Stress Criterion (Version 0.0.3) [Computer software]. https://pypi.org/project/stresspy/
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stresspy-0.0.3.tar.gz.
File metadata
- Download URL: stresspy-0.0.3.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c17e1afdc0031976a4c21a43537c609c0ce72eb23b676f76c887dad4ed33ecc7
|
|
| MD5 |
c580e60d5ee99946216d5f33237d7eae
|
|
| BLAKE2b-256 |
43f9dcb5dd832c6efad69abe15d6282e9a65b6b3034af170d899da5ca145a8f1
|
File details
Details for the file stresspy-0.0.3-py3-none-any.whl.
File metadata
- Download URL: stresspy-0.0.3-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40887cf0f768c8e855c83beb12c8ff6e0d34713390e4ba1ad7049e098be9da13
|
|
| MD5 |
11e0b7da6a2aa361095003bdebf9c4b2
|
|
| BLAKE2b-256 |
4cd2d527e0f3247e15959129b73eb7d7af37f4c6deb09872068468b4a957534a
|