We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Warning incorrectly raised by SpectrumDatasetMaker.make_exposure with use_region_center=True
**Gammapy version**
v0.19

**Bug description**
If using `SpectrumDatasetMaker.make_exposure` with pointlike IRFs, a warning is incorrectly raised if the option `user_region_center` is set to True.

See this lien of code:
https://github.com/gammapy/gammapy/blob/ba7d377bf48bd53d268d2dc14be1c1eb013a1e42/gammapy/makers/spectrum.py#L67

**Expected behavior**
No warning should be raised.

**To Reproduce**

**Other information**


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `gammapy/makers/spectrum.py`
Content:
```
1 # Licensed under a 3-clause BSD style license - see LICENSE.rst
2 import logging
3 from regions import CircleSkyRegion
4 from .map import MapDatasetMaker
5 
6 __all__ = ["SpectrumDatasetMaker"]
7 
8 log = logging.getLogger(__name__)
9 
10 
11 class SpectrumDatasetMaker(MapDatasetMaker):
12     """Make spectrum for a single IACT observation.
13 
14     The irfs and background are computed at a single fixed offset,
15     which is recommend only for point-sources.
16 
17     Parameters
18     ----------
19     selection : list
20         List of str, selecting which maps to make.
21         Available: 'counts', 'exposure', 'background', 'edisp'
22         By default, all spectra are made.
23     containment_correction : bool
24         Apply containment correction for point sources and circular on regions.
25     background_oversampling : int
26         Background evaluation oversampling factor in energy.
27     use_region_center : bool
28         Approximate the IRFs by the value at the center of the region
29     """
30 
31     tag = "SpectrumDatasetMaker"
32     available_selection = ["counts", "background", "exposure", "edisp"]
33 
34     def __init__(
35         self,
36         selection=None,
37         containment_correction=False,
38         background_oversampling=None,
39         use_region_center=True,
40     ):
41         self.containment_correction = containment_correction
42         self.use_region_center = use_region_center
43         super().__init__(
44             selection=selection, background_oversampling=background_oversampling
45         )
46 
47     def make_exposure(self, geom, observation):
48         """Make exposure.
49 
50         Parameters
51         ----------
52         geom : `~gammapy.maps.RegionGeom`
53             Reference map geom.
54         observation: `~gammapy.data.Observation`
55             Observation to compute effective area for.
56 
57         Returns
58         -------
59         exposure : `~gammapy.maps.RegionNDMap`
60             Exposure map.
61         """
62         exposure = super().make_exposure(
63             geom, observation, use_region_center=self.use_region_center
64         )
65 
66         is_pointlike = exposure.meta.get("is_pointlike", False)
67         if is_pointlike:
68             log.warning(
69                 "MapMaker: use_region_center=False should not be used with point-like IRF. "
70                 "Results are likely inaccurate."
71             )
72 
73         if self.containment_correction:
74             if is_pointlike:
75                 raise ValueError(
76                     "Cannot apply containment correction for point-like IRF."
77                 )
78 
79             if not isinstance(geom.region, CircleSkyRegion):
80                 raise TypeError(
81                     "Containment correction only supported for circular regions."
82                 )
83             offset = geom.separation(observation.pointing_radec)
84             containment = observation.psf.containment(
85                 rad=geom.region.radius,
86                 offset=offset,
87                 energy_true=geom.axes["energy_true"].center,
88             )
89             exposure.quantity *= containment.reshape(geom.data_shape)
90 
91         return exposure
92
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/gammapy/makers/spectrum.py b/gammapy/makers/spectrum.py
--- a/gammapy/makers/spectrum.py
+++ b/gammapy/makers/spectrum.py
@@ -64,7 +64,7 @@
         )
 
         is_pointlike = exposure.meta.get("is_pointlike", False)
-        if is_pointlike:
+        if is_pointlike and self.use_region_center is False:
             log.warning(
                 "MapMaker: use_region_center=False should not be used with point-like IRF. "
                 "Results are likely inaccurate."

{"golden_diff": "diff --git a/gammapy/makers/spectrum.py b/gammapy/makers/spectrum.py\n--- a/gammapy/makers/spectrum.py\n+++ b/gammapy/makers/spectrum.py\n@@ -64,7 +64,7 @@\n         )\n \n         is_pointlike = exposure.meta.get(\"is_pointlike\", False)\n-        if is_pointlike:\n+        if is_pointlike and self.use_region_center is False:\n             log.warning(\n                 \"MapMaker: use_region_center=False should not be used with point-like IRF. \"\n                 \"Results are likely inaccurate.\"\n", "issue": "Warning incorrectly raised by SpectrumDatasetMaker.make_exposure with use_region_center=True\n**Gammapy version**\r\nv0.19\r\n\r\n**Bug description**\r\nIf using `SpectrumDatasetMaker.make_exposure` with pointlike IRFs, a warning is incorrectly raised if the option `user_region_center` is set to True.\r\n\r\nSee this lien of code:\r\nhttps://github.com/gammapy/gammapy/blob/ba7d377bf48bd53d268d2dc14be1c1eb013a1e42/gammapy/makers/spectrum.py#L67\r\n\r\n**Expected behavior**\r\nNo warning should be raised.\r\n\r\n**To Reproduce**\r\n\r\n**Other information**\r\n\n", "before_files": [{"content": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport logging\nfrom regions import CircleSkyRegion\nfrom .map import MapDatasetMaker\n\n__all__ = [\"SpectrumDatasetMaker\"]\n\nlog = logging.getLogger(__name__)\n\n\nclass SpectrumDatasetMaker(MapDatasetMaker):\n    \"\"\"Make spectrum for a single IACT observation.\n\n    The irfs and background are computed at a single fixed offset,\n    which is recommend only for point-sources.\n\n    Parameters\n    ----------\n    selection : list\n        List of str, selecting which maps to make.\n        Available: 'counts', 'exposure', 'background', 'edisp'\n        By default, all spectra are made.\n    containment_correction : bool\n        Apply containment correction for point sources and circular on regions.\n    background_oversampling : int\n        Background evaluation oversampling factor in energy.\n    use_region_center : bool\n        Approximate the IRFs by the value at the center of the region\n    \"\"\"\n\n    tag = \"SpectrumDatasetMaker\"\n    available_selection = [\"counts\", \"background\", \"exposure\", \"edisp\"]\n\n    def __init__(\n        self,\n        selection=None,\n        containment_correction=False,\n        background_oversampling=None,\n        use_region_center=True,\n    ):\n        self.containment_correction = containment_correction\n        self.use_region_center = use_region_center\n        super().__init__(\n            selection=selection, background_oversampling=background_oversampling\n        )\n\n    def make_exposure(self, geom, observation):\n        \"\"\"Make exposure.\n\n        Parameters\n        ----------\n        geom : `~gammapy.maps.RegionGeom`\n            Reference map geom.\n        observation: `~gammapy.data.Observation`\n            Observation to compute effective area for.\n\n        Returns\n        -------\n        exposure : `~gammapy.maps.RegionNDMap`\n            Exposure map.\n        \"\"\"\n        exposure = super().make_exposure(\n            geom, observation, use_region_center=self.use_region_center\n        )\n\n        is_pointlike = exposure.meta.get(\"is_pointlike\", False)\n        if is_pointlike:\n            log.warning(\n                \"MapMaker: use_region_center=False should not be used with point-like IRF. \"\n                \"Results are likely inaccurate.\"\n            )\n\n        if self.containment_correction:\n            if is_pointlike:\n                raise ValueError(\n                    \"Cannot apply containment correction for point-like IRF.\"\n                )\n\n            if not isinstance(geom.region, CircleSkyRegion):\n                raise TypeError(\n                    \"Containment correction only supported for circular regions.\"\n                )\n            offset = geom.separation(observation.pointing_radec)\n            containment = observation.psf.containment(\n                rad=geom.region.radius,\n                offset=offset,\n                energy_true=geom.axes[\"energy_true\"].center,\n            )\n            exposure.quantity *= containment.reshape(geom.data_shape)\n\n        return exposure\n", "path": "gammapy/makers/spectrum.py"}], "after_files": [{"content": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\nimport logging\nfrom regions import CircleSkyRegion\nfrom .map import MapDatasetMaker\n\n__all__ = [\"SpectrumDatasetMaker\"]\n\nlog = logging.getLogger(__name__)\n\n\nclass SpectrumDatasetMaker(MapDatasetMaker):\n    \"\"\"Make spectrum for a single IACT observation.\n\n    The irfs and background are computed at a single fixed offset,\n    which is recommend only for point-sources.\n\n    Parameters\n    ----------\n    selection : list\n        List of str, selecting which maps to make.\n        Available: 'counts', 'exposure', 'background', 'edisp'\n        By default, all spectra are made.\n    containment_correction : bool\n        Apply containment correction for point sources and circular on regions.\n    background_oversampling : int\n        Background evaluation oversampling factor in energy.\n    use_region_center : bool\n        Approximate the IRFs by the value at the center of the region\n    \"\"\"\n\n    tag = \"SpectrumDatasetMaker\"\n    available_selection = [\"counts\", \"background\", \"exposure\", \"edisp\"]\n\n    def __init__(\n        self,\n        selection=None,\n        containment_correction=False,\n        background_oversampling=None,\n        use_region_center=True,\n    ):\n        self.containment_correction = containment_correction\n        self.use_region_center = use_region_center\n        super().__init__(\n            selection=selection, background_oversampling=background_oversampling\n        )\n\n    def make_exposure(self, geom, observation):\n        \"\"\"Make exposure.\n\n        Parameters\n        ----------\n        geom : `~gammapy.maps.RegionGeom`\n            Reference map geom.\n        observation: `~gammapy.data.Observation`\n            Observation to compute effective area for.\n\n        Returns\n        -------\n        exposure : `~gammapy.maps.RegionNDMap`\n            Exposure map.\n        \"\"\"\n        exposure = super().make_exposure(\n            geom, observation, use_region_center=self.use_region_center\n        )\n\n        is_pointlike = exposure.meta.get(\"is_pointlike\", False)\n        if is_pointlike and self.use_region_center is False:\n            log.warning(\n                \"MapMaker: use_region_center=False should not be used with point-like IRF. \"\n                \"Results are likely inaccurate.\"\n            )\n\n        if self.containment_correction:\n            if is_pointlike:\n                raise ValueError(\n                    \"Cannot apply containment correction for point-like IRF.\"\n                )\n\n            if not isinstance(geom.region, CircleSkyRegion):\n                raise TypeError(\n                    \"Containment correction only supported for circular regions.\"\n                )\n            offset = geom.separation(observation.pointing_radec)\n            containment = observation.psf.containment(\n                rad=geom.region.radius,\n                offset=offset,\n                energy_true=geom.axes[\"energy_true\"].center,\n            )\n            exposure.quantity *= containment.reshape(geom.data_shape)\n\n        return exposure\n", "path": "gammapy/makers/spectrum.py"}]}