docs: update documentation files and fix linting issues

This commit is contained in:
2026-07-07 13:32:48 +03:00
parent 9bf1e1333e
commit be3e288e0d
27 changed files with 423 additions and 250 deletions
+31 -13
View File
@@ -21,20 +21,24 @@ class TestRadiativeEndpointHandling:
result = rc(W_near_end)
assert not np.isnan(result[0]), "Resummed correction must be finite at endpoint"
assert not np.isinf(result[0]), "Resummed correction must not diverge at endpoint"
assert not np.isinf(
result[0]
), "Resummed correction must not diverge at endpoint"
@pytest.mark.physics
def test_standard_mode_diverges(self):
"""Without resummation, δᵣ → −∞ as W → W₀ (logarithmic divergence)."""
rc = RadiativeCorrection(W0=5.0, use_endpoint_resummation=False)
W_far = np.array([4.9]) # ΔW = 0.1
W_far = np.array([4.9]) # ΔW = 0.1
W_close = np.array([4.99]) # ΔW = 0.01
val_far = rc(W_far)[0]
val_close = rc(W_close)[0]
assert val_close < val_far, "Standard mode must show divergent behavior near endpoint"
assert (
val_close < val_far
), "Standard mode must show divergent behavior near endpoint"
class TestRadiativeEnergyDependence:
@@ -51,7 +55,9 @@ class TestRadiativeEnergyDependence:
r_mid = rc(mid_W)[0]
r_near = rc(near_end_W)[0]
assert r_near <= r_mid, f"Correction factor should decrease near endpoint: {r_mid} → {r_near}"
assert (
r_near <= r_mid
), f"Correction factor should decrease near endpoint: {r_mid} → {r_near}"
class TestRadiativeResummationSwitch:
@@ -73,8 +79,12 @@ class TestRadiativeResummationSwitch:
r_standard = rc_standard(W_near)[0]
assert not np.isnan(r_resummed), "Resummed mode must be finite"
assert not np.isnan(r_standard), "Standard mode must be finite (mask protects endpoint)"
assert r_resummed > r_standard, f"Near endpoint: resummed={r_resummed} > standard={r_standard}"
assert not np.isnan(
r_standard
), "Standard mode must be finite (mask protects endpoint)"
assert (
r_resummed > r_standard
), f"Near endpoint: resummed={r_resummed} > standard={r_standard}"
@pytest.mark.physics
def test_resummation_only_near_endpoint(self):
@@ -87,9 +97,9 @@ class TestRadiativeResummationSwitch:
r_resummed_far = rc_resummed(W_far)[0]
r_standard_far = rc_standard(W_far)[0]
assert np.isclose(r_resummed_far, r_standard_far, rtol=1e-10), (
f"Far from endpoint: resummed={r_resummed_far}, standard={r_standard_far}"
)
assert np.isclose(
r_resummed_far, r_standard_far, rtol=1e-10
), f"Far from endpoint: resummed={r_resummed_far}, standard={r_standard_far}"
# Very near endpoint (delta_W < delta_cut): resummed is finite and larger
W_near = np.array([4.9995])
@@ -121,7 +131,9 @@ class TestRadiativeZDependence:
W_test = np.linspace(1.5, 4.5, 10)
diff = np.abs(rc_z50(W_test) - rc_z1(W_test))
assert np.max(diff) > 1e-4, f"Z=1 and Z=50 should differ: max diff = {np.max(diff)}"
assert (
np.max(diff) > 1e-4
), f"Z=1 and Z=50 should differ: max diff = {np.max(diff)}"
@pytest.mark.physics
def test_z_correction_magnitude_reasonable(self):
@@ -129,7 +141,9 @@ class TestRadiativeZDependence:
rc = RadiativeCorrection(W0=5.0, Z=92, use_endpoint_resummation=True)
W_test = np.array([3.0])
result = rc(W_test)
assert 0.9 < result[0] < 3.0, f"Z=92 correction should be reasonable: {result[0]}"
assert (
0.9 < result[0] < 3.0
), f"Z=92 correction should be reasonable: {result[0]}"
class TestRadiativeAParameter:
@@ -138,8 +152,12 @@ class TestRadiativeAParameter:
@pytest.mark.physics
def test_a_affects_nuclear_model_correction(self):
"""A parameter affects the nuclear-structure-dependent part of O(Z*alpha^2)."""
rc_a100 = RadiativeCorrection(W0=5.0, Z=50, A=100, use_endpoint_resummation=True)
rc_a140 = RadiativeCorrection(W0=5.0, Z=50, A=140, use_endpoint_resummation=True)
rc_a100 = RadiativeCorrection(
W0=5.0, Z=50, A=100, use_endpoint_resummation=True
)
rc_a140 = RadiativeCorrection(
W0=5.0, Z=50, A=140, use_endpoint_resummation=True
)
W_test = np.array([3.0])
assert rc_a100(W_test)[0] != rc_a140(W_test)[0], (