nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: asdf-format/asdf
Pull request #1936 (2025-06-24 19:08:03)

deprecate url_mapping argument to get_validator
Deprecate `url_mapping` argument to `get_validator`. Arbitrary mapping of uris/urls is no longer supported.

Closes: #1864

## Tasks

- [ ] [run `pre-commit` on your machine](https://pre-commit.com/#quick-start)
- [ ] run `pytest` on your machine
- [ ] Does this PR add new features and / or change user-facing code / API? (if not, label with `no-changelog-entry-needed`)
    - [ ] write news fragment(s) in `changes/`: `echo "changed something" > changes/<PR#>.<changetype>.rst` (see below for change types)
    - [ ] update relevant docstrings and / or `docs/` page
    - [ ] for any new features, add unit tests

<details><summary>news fragment change types...</summary>

- ``changes/<PR#>.feature.rst``: new feature
- ``changes/<PR#>.bugfix.rst``: bug fix
- ``changes/<PR#>.doc.rst``: documentation change
- ``changes/<PR#>.removal.rst``: deprecation or removal of public API
- ``changes/<PR#>.general.rst``: infrastructure or miscellaneous change
</details>



Patch:
diff --git a/asdf/schema.py b/asdf/schema.py
index b83552ad..74599398 100644
--- a/asdf/schema.py
+++ b/asdf/schema.py
@@ -518,6 +518,7 @@ def get_validator(
         of the built-in ones and ones provided by extension types).
 
     url_mapping : callable, optional
+        DEPRECATED
         A callable that takes one string argument and returns a string
         to convert remote URLs into local ones.
 
@@ -532,6 +533,9 @@ def get_validator(
     -------
     validator : jsonschema.Validator
     """
+    if url_mapping is not None:
+        warnings.warn("url_mapping is deprecated, arbitrary mapping of uris is no longer supported", DeprecationWarning)
+
     if ctx is None:
         from ._asdf import AsdfFile
 
diff --git a/changes/1936.removal.rst b/changes/1936.removal.rst
new file mode 100644
index 00000000..816d0480
--- /dev/null
+++ b/changes/1936.removal.rst
@@ -0,0 +1,1 @@
+Deprecate ``url_mapping`` argument to ``get_validator``. Arbitrary mapping of urls is no longer supported.


Test patch:
diff --git a/asdf/_tests/test_deprecated.py b/asdf/_tests/test_deprecated.py
index 00eb5acc..48c4ed0d 100644
--- a/asdf/_tests/test_deprecated.py
+++ b/asdf/_tests/test_deprecated.py
@@ -48,3 +48,8 @@ properties:
     with pytest.warns(DeprecationWarning, match=f"Use of the {schema_property} validator with non-ndarray tag"):
         with pytest.raises(asdf.exceptions.ValidationError):
             af.validate()
+
+
+def test_url_mapping_deprecation():
+    with pytest.warns(DeprecationWarning, match="url_mapping is deprecated"):
+        asdf.schema.get_validator(url_mapping=lambda s: s)
Repository: gammapy/gammapy
Pull request #5694 (2025-02-06 00:16:56)

`e_peak` on `SuperExpCutoffPowerLaw4FGLDR3SpectralModel`
This PR adds an `e_peak` property on `SuperExpCutoffPowerLaw4FGLDR3SpectralModel`. 
I took the formula in https://iopscience.iop.org/article/10.3847/1538-4357/acee67 Eq. 21. 
As far as I know, no formula for e_peak is given in the 4FGL-DR3 paper that we cite in the model gallery page of this model (https://arxiv.org/pdf/2201.11184.pdf). 


Patch:
diff --git a/gammapy/modeling/models/spectral.py b/gammapy/modeling/models/spectral.py
index b8b21bc7f..f3824202c 100644
--- a/gammapy/modeling/models/spectral.py
+++ b/gammapy/modeling/models/spectral.py
@@ -1606,6 +1606,23 @@ class SuperExpCutoffPowerLaw4FGLDR3SpectralModel(SpectralModel):
         cutoff[mask] = (energy[mask] / reference) ** power
         return pwl * cutoff
 
+    @property
+    def e_peak(self):
+        r"""Spectral energy distribution peak energy (`~astropy.units.Quantity`).
+
+        This is the peak in E^2 x dN/dE and is given by Eq. 21 of https://iopscience.iop.org/article/10.3847/1538-4357/acee67:
+
+        .. math::
+            E_{Peak} = E_{0} \left[1+\frac{\Gamma_2}{a}(2 - \Gamma_1)\right]^{\frac{1}{\Gamma_2}}
+        """
+        reference = self.reference.quantity
+        index_1 = self.index_1.quantity
+        index_2 = self.index_2.quantity
+        expfactor = self.expfactor.quantity
+        if ((index_1 > 2) and (index_2 > 0)) or (expfactor <= 0) or (index_2 <= 0):
+            return np.nan * reference.unit
+        return reference * (1 + (index_2 / expfactor) * (2 - index_1)) ** (1 / index_2)
+
 
 class LogParabolaSpectralModel(SpectralModel):
     r"""Spectral log parabola model.


Test patch:
diff --git a/gammapy/modeling/models/tests/test_spectral.py b/gammapy/modeling/models/tests/test_spectral.py
index 795bd816a..a1cefcb54 100644
--- a/gammapy/modeling/models/tests/test_spectral.py
+++ b/gammapy/modeling/models/tests/test_spectral.py
@@ -168,6 +168,7 @@ TEST_MODELS = [
         val_at_2TeV=u.Quantity(0.35212994, "cm-2 s-1 TeV-1"),
         integral_1_10TeV=u.Quantity(1.328499, "cm-2 s-1"),
         eflux_1_10TeV=u.Quantity(4.067067, "TeV cm-2 s-1"),
+        e_peak=10.0498756 * u.TeV,
     ),
     dict(
         name="logpar",