StressPy v0.1: Core Developer Guide
stresspy is an early reference implementation of the deterministic numerical core of the Geometric Stress Criterion (GSC). It decomposes a model–data discrepancy into components that are locally accessible and inaccessible through variation of the model's adjustable parameters.
Version 0.1 is intentionally small. It does not fit models, infer the meaning of uploaded data, construct ODE Jacobians, or perform bootstrap calibration. Those capabilities can be added around the core after the central calculation has been independently tested.
1. Mathematical Convention
At a specified parameter point $\hat{\theta}$, let
$$r = y - f(\hat{\theta})$$
be the model–data discrepancy and let
$$J = \left.\frac{\partial f}{\partial x}\right\vert{}_{\hat{\theta}}$$
be the Jacobian with respect to the chosen parameter coordinates $x$.
After applying an observation-space whitening transformation $L$, GSC uses
$$r_W = Lr, \qquad J_W = LJ$$
If $U_r$ contains the retained left singular vectors of $J_W$, then
$$r_{\parallel,W} = U_r U_r^\top r_W, \qquad r_{\perp,W} = r_W - r_{\parallel,W}$$
The reported stresses are
$$S_{\mathrm{total}} = \Vert{}r_W\Vert{}2^2, \qquad S{\parallel} = \Vert{}r_{\parallel,W}\Vert{}2^2, \qquad S{\perp} = \Vert{}r_{\perp,W}\Vert{}_2^2$$
with normal fraction
$$F_{\perp} = \frac{S_{\perp}}{S_{\mathrm{total}}}$$
The minimum-norm local repair is
$$\Delta x = V_r \Sigma_r^{-1} U_r^\top r_W$$
Under the local linear approximation,
$$r - J \Delta x = r_\perp$$
The repair is minimum-norm only in the coordinates used to construct $J$. Its magnitude is therefore coordinate-dependent. Local tangent accessibility also does not imply that the corresponding finite nonlinear step is practical.
2. What the Core Returns
decompose() returns a GSCResult object containing:
| Result Field | Meaning |
|---|---|
total_stress |
Total squared discrepancy in the selected metric |
tangent_stress |
Squared tangent-accessible component |
normal_stress |
Squared locally inaccessible component |
normal_fraction |
normal_stress / total_stress |
rank |
Number of retained Jacobian singular directions |
rank_threshold |
Singular-value threshold used for retention |
singular_values |
Singular spectrum of the whitened Jacobian |
repair_vector |
Minimum-norm local repair in the supplied coordinates |
repair_norm |
Euclidean norm of that coordinate repair |
condition_number |
Condition number of the retained tangent system |
component vectors |
Residual, tangent and normal vectors in weighted and original coordinates |
Note: When the total discrepancy is exactly zero, normal_fraction is reported as nan, because the ratio is mathematically undefined.
3. Basic Usage
import numpy as np
from stresspy import decompose
J = np.array([
[1.0, 0.0],
[1.0, 1.0],
[0.0, 1.0],
])
predicted = np.array([1.0, 2.0, 1.0])
observed = np.array([1.1, 1.9, 0.9])
sigma = np.array([0.1, 0.1, 0.1])
result = decompose(
observed=observed,
predicted=predicted,
jacobian=J,
sigma=sigma,
rank_rtol=1e-8,
)
print(result.rank)
print(result.total_stress)
print(result.tangent_stress)
print(result.normal_stress)
print(result.normal_fraction_pct)
print(result.repair_vector)
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.2.tar.gz.
File metadata
- Download URL: stresspy-0.0.2.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a958d67149b09fc5292ae9366244d4d8f5a88b0421d7d1e51b973d2d5b731fc
|
|
| MD5 |
a82e2f1525af4e0c456c1735dd7964ef
|
|
| BLAKE2b-256 |
3510405f29ba9589f97a06e316b9619755f2c608f6d7753045529ec99800318a
|
File details
Details for the file stresspy-0.0.2-py3-none-any.whl.
File metadata
- Download URL: stresspy-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.8 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 |
7df33d8ca96db36b8805c2d6e5197edfd5e62fa414d9526686e48f27cf483b68
|
|
| MD5 |
7a4876c63ade2eb56f0139478553fdd0
|
|
| BLAKE2b-256 |
e0617a6e662d34abbc45a786edeaca9a4b47a887c42900bd2d9e3f50dafabb66
|