prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Correlated background simplemodel
  something like
  
  ```python
  def simplemodel2(s,b_up,b_nom,b_dn):
      spec = {
          'channels': [
              {
                  'name': 'singlechannel',
                  'samples': [
                      {
                      'name': 'signal',
                      'data': s,
                      'modifiers': [{'name': 'mu', 'type': 'normfactor', 'data': None}]
                      },
                      {'name': 'background',
                      'data': b_nom,
                      'modifiers': [
                          {
                              'name': 'uncorr_bkguncrt',
                              'type': 'histosys',
                              'data': {
                                  'hi_data': b_up,
                                  'lo_data': b_dn
                              }
                          }
                          ]
                      }
                  ]
              }
          ]
      }
      return pyhf.Model(spec)
  
  ```
  
  with an API like `pyhf.simplemodels.correlated_bkg`
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `src/pyhf/simplemodels.py`
  Content:
  ```
  1 from . import Model
  2 
  3 __all__ = ["hepdata_like"]
  4 
  5 
  6 def __dir__():
  7     return __all__
  8 
  9 
  10 def hepdata_like(signal_data, bkg_data, bkg_uncerts, batch_size=None):
  11     """
  12     Construct a simple single channel :class:`~pyhf.pdf.Model` with a
  13     :class:`~pyhf.modifiers.shapesys` modifier representing an uncorrelated
  14     background uncertainty.
  15 
  16     Example:
  17         >>> import pyhf
  18         >>> pyhf.set_backend("numpy")
  19         >>> model = pyhf.simplemodels.hepdata_like(
  20         ...     signal_data=[12.0, 11.0], bkg_data=[50.0, 52.0], bkg_uncerts=[3.0, 7.0]
  21         ... )
  22         >>> model.schema
  23         'model.json'
  24         >>> model.config.channels
  25         ['singlechannel']
  26         >>> model.config.samples
  27         ['background', 'signal']
  28         >>> model.config.parameters
  29         ['mu', 'uncorr_bkguncrt']
  30         >>> model.expected_data(model.config.suggested_init())
  31         array([ 62.        ,  63.        , 277.77777778,  55.18367347])
  32 
  33     Args:
  34         signal_data (:obj:`list`): The data in the signal sample
  35         bkg_data (:obj:`list`): The data in the background sample
  36         bkg_uncerts (:obj:`list`): The statistical uncertainty on the background sample counts
  37         batch_size (:obj:`None` or :obj:`int`): Number of simultaneous (batched) Models to compute
  38 
  39     Returns:
  40         ~pyhf.pdf.Model: The statistical model adhering to the :obj:`model.json` schema
  41 
  42     """
  43     spec = {
  44         'channels': [
  45             {
  46                 'name': 'singlechannel',
  47                 'samples': [
  48                     {
  49                         'name': 'signal',
  50                         'data': signal_data,
  51                         'modifiers': [
  52                             {'name': 'mu', 'type': 'normfactor', 'data': None}
  53                         ],
  54                     },
  55                     {
  56                         'name': 'background',
  57                         'data': bkg_data,
  58                         'modifiers': [
  59                             {
  60                                 'name': 'uncorr_bkguncrt',
  61                                 'type': 'shapesys',
  62                                 'data': bkg_uncerts,
  63                             }
  64                         ],
  65                     },
  66                 ],
  67             }
  68         ]
  69     }
  70     return Model(spec, batch_size=batch_size)
  71
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/src/pyhf/simplemodels.py b/src/pyhf/simplemodels.py
  --- a/src/pyhf/simplemodels.py
  +++ b/src/pyhf/simplemodels.py
  @@ -1,12 +1,81 @@
   from . import Model
   
  -__all__ = ["hepdata_like"]
  +__all__ = ["correlated_background", "hepdata_like"]
   
   
   def __dir__():
       return __all__
   
   
  +def correlated_background(signal, bkg, bkg_up, bkg_down, batch_size=None):
  +    r"""
  +    Construct a simple single channel :class:`~pyhf.pdf.Model` with a
  +    :class:`~pyhf.modifiers.histosys` modifier representing a background
  +    with a fully correlated bin-by-bin uncertainty.
  +
  +    Args:
  +        signal (:obj:`list`): The data in the signal sample.
  +        bkg (:obj:`list`): The data in the background sample.
  +        bkg_up (:obj:`list`): The background sample under an upward variation
  +         corresponding to :math:`\alpha=+1`.
  +        bkg_down (:obj:`list`): The background sample under a downward variation
  +         corresponding to :math:`\alpha=-1`.
  +        batch_size (:obj:`None` or :obj:`int`): Number of simultaneous (batched) Models to compute.
  +
  +    Returns:
  +        ~pyhf.pdf.Model: The statistical model adhering to the :obj:`model.json` schema.
  +
  +    Example:
  +        >>> import pyhf
  +        >>> pyhf.set_backend("numpy")
  +        >>> model = pyhf.simplemodels.correlated_background(
  +        ...     signal=[12.0, 11.0],
  +        ...     bkg=[50.0, 52.0],
  +        ...     bkg_up=[45.0, 57.0],
  +        ...     bkg_down=[55.0, 47.0],
  +        ... )
  +        >>> model.schema
  +        'model.json'
  +        >>> model.config.channels
  +        ['single_channel']
  +        >>> model.config.samples
  +        ['background', 'signal']
  +        >>> model.config.parameters
  +        ['correlated_bkg_uncertainty', 'mu']
  +        >>> model.expected_data(model.config.suggested_init())
  +        array([62., 63.,  0.])
  +
  +    """
  +    spec = {
  +        "channels": [
  +            {
  +                "name": "single_channel",
  +                "samples": [
  +                    {
  +                        "name": "signal",
  +                        "data": signal,
  +                        "modifiers": [
  +                            {"name": "mu", "type": "normfactor", "data": None}
  +                        ],
  +                    },
  +                    {
  +                        "name": "background",
  +                        "data": bkg,
  +                        "modifiers": [
  +                            {
  +                                "name": "correlated_bkg_uncertainty",
  +                                "type": "histosys",
  +                                "data": {"hi_data": bkg_up, "lo_data": bkg_down},
  +                            }
  +                        ],
  +                    },
  +                ],
  +            }
  +        ]
  +    }
  +    return Model(spec, batch_size=batch_size)
  +
  +
   def hepdata_like(signal_data, bkg_data, bkg_uncerts, batch_size=None):
       """
       Construct a simple single channel :class:`~pyhf.pdf.Model` with a
  
verification_info: {"golden_diff": "diff --git a/src/pyhf/simplemodels.py b/src/pyhf/simplemodels.py\n--- a/src/pyhf/simplemodels.py\n+++ b/src/pyhf/simplemodels.py\n@@ -1,12 +1,81 @@\n from . import Model\n \n-__all__ = [\"hepdata_like\"]\n+__all__ = [\"correlated_background\", \"hepdata_like\"]\n \n \n def __dir__():\n     return __all__\n \n \n+def correlated_background(signal, bkg, bkg_up, bkg_down, batch_size=None):\n+    r\"\"\"\n+    Construct a simple single channel :class:`~pyhf.pdf.Model` with a\n+    :class:`~pyhf.modifiers.histosys` modifier representing a background\n+    with a fully correlated bin-by-bin uncertainty.\n+\n+    Args:\n+        signal (:obj:`list`): The data in the signal sample.\n+        bkg (:obj:`list`): The data in the background sample.\n+        bkg_up (:obj:`list`): The background sample under an upward variation\n+         corresponding to :math:`\\alpha=+1`.\n+        bkg_down (:obj:`list`): The background sample under a downward variation\n+         corresponding to :math:`\\alpha=-1`.\n+        batch_size (:obj:`None` or :obj:`int`): Number of simultaneous (batched) Models to compute.\n+\n+    Returns:\n+        ~pyhf.pdf.Model: The statistical model adhering to the :obj:`model.json` schema.\n+\n+    Example:\n+        >>> import pyhf\n+        >>> pyhf.set_backend(\"numpy\")\n+        >>> model = pyhf.simplemodels.correlated_background(\n+        ...     signal=[12.0, 11.0],\n+        ...     bkg=[50.0, 52.0],\n+        ...     bkg_up=[45.0, 57.0],\n+        ...     bkg_down=[55.0, 47.0],\n+        ... )\n+        >>> model.schema\n+        'model.json'\n+        >>> model.config.channels\n+        ['single_channel']\n+        >>> model.config.samples\n+        ['background', 'signal']\n+        >>> model.config.parameters\n+        ['correlated_bkg_uncertainty', 'mu']\n+        >>> model.expected_data(model.config.suggested_init())\n+        array([62., 63.,  0.])\n+\n+    \"\"\"\n+    spec = {\n+        \"channels\": [\n+            {\n+                \"name\": \"single_channel\",\n+                \"samples\": [\n+                    {\n+                        \"name\": \"signal\",\n+                        \"data\": signal,\n+                        \"modifiers\": [\n+                            {\"name\": \"mu\", \"type\": \"normfactor\", \"data\": None}\n+                        ],\n+                    },\n+                    {\n+                        \"name\": \"background\",\n+                        \"data\": bkg,\n+                        \"modifiers\": [\n+                            {\n+                                \"name\": \"correlated_bkg_uncertainty\",\n+                                \"type\": \"histosys\",\n+                                \"data\": {\"hi_data\": bkg_up, \"lo_data\": bkg_down},\n+                            }\n+                        ],\n+                    },\n+                ],\n+            }\n+        ]\n+    }\n+    return Model(spec, batch_size=batch_size)\n+\n+\n def hepdata_like(signal_data, bkg_data, bkg_uncerts, batch_size=None):\n     \"\"\"\n     Construct a simple single channel :class:`~pyhf.pdf.Model` with a\n", "issue": "Correlated background simplemodel\nsomething like\r\n\r\n```python\r\ndef simplemodel2(s,b_up,b_nom,b_dn):\r\n    spec = {\r\n        'channels': [\r\n            {\r\n                'name': 'singlechannel',\r\n                'samples': [\r\n                    {\r\n                    'name': 'signal',\r\n                    'data': s,\r\n                    'modifiers': [{'name': 'mu', 'type': 'normfactor', 'data': None}]\r\n                    },\r\n                    {'name': 'background',\r\n                    'data': b_nom,\r\n                    'modifiers': [\r\n                        {\r\n                            'name': 'uncorr_bkguncrt',\r\n                            'type': 'histosys',\r\n                            'data': {\r\n                                'hi_data': b_up,\r\n                                'lo_data': b_dn\r\n                            }\r\n                        }\r\n                        ]\r\n                    }\r\n                ]\r\n            }\r\n        ]\r\n    }\r\n    return pyhf.Model(spec)\r\n\r\n```\r\n\r\nwith an API like `pyhf.simplemodels.correlated_bkg`\n", "before_files": [{"content": "from . import Model\n\n__all__ = [\"hepdata_like\"]\n\n\ndef __dir__():\n    return __all__\n\n\ndef hepdata_like(signal_data, bkg_data, bkg_uncerts, batch_size=None):\n    \"\"\"\n    Construct a simple single channel :class:`~pyhf.pdf.Model` with a\n    :class:`~pyhf.modifiers.shapesys` modifier representing an uncorrelated\n    background uncertainty.\n\n    Example:\n        >>> import pyhf\n        >>> pyhf.set_backend(\"numpy\")\n        >>> model = pyhf.simplemodels.hepdata_like(\n        ...     signal_data=[12.0, 11.0], bkg_data=[50.0, 52.0], bkg_uncerts=[3.0, 7.0]\n        ... )\n        >>> model.schema\n        'model.json'\n        >>> model.config.channels\n        ['singlechannel']\n        >>> model.config.samples\n        ['background', 'signal']\n        >>> model.config.parameters\n        ['mu', 'uncorr_bkguncrt']\n        >>> model.expected_data(model.config.suggested_init())\n        array([ 62.        ,  63.        , 277.77777778,  55.18367347])\n\n    Args:\n        signal_data (:obj:`list`): The data in the signal sample\n        bkg_data (:obj:`list`): The data in the background sample\n        bkg_uncerts (:obj:`list`): The statistical uncertainty on the background sample counts\n        batch_size (:obj:`None` or :obj:`int`): Number of simultaneous (batched) Models to compute\n\n    Returns:\n        ~pyhf.pdf.Model: The statistical model adhering to the :obj:`model.json` schema\n\n    \"\"\"\n    spec = {\n        'channels': [\n            {\n                'name': 'singlechannel',\n                'samples': [\n                    {\n                        'name': 'signal',\n                        'data': signal_data,\n                        'modifiers': [\n                            {'name': 'mu', 'type': 'normfactor', 'data': None}\n                        ],\n                    },\n                    {\n                        'name': 'background',\n                        'data': bkg_data,\n                        'modifiers': [\n                            {\n                                'name': 'uncorr_bkguncrt',\n                                'type': 'shapesys',\n                                'data': bkg_uncerts,\n                            }\n                        ],\n                    },\n                ],\n            }\n        ]\n    }\n    return Model(spec, batch_size=batch_size)\n", "path": "src/pyhf/simplemodels.py"}], "after_files": [{"content": "from . import Model\n\n__all__ = [\"correlated_background\", \"hepdata_like\"]\n\n\ndef __dir__():\n    return __all__\n\n\ndef correlated_background(signal, bkg, bkg_up, bkg_down, batch_size=None):\n    r\"\"\"\n    Construct a simple single channel :class:`~pyhf.pdf.Model` with a\n    :class:`~pyhf.modifiers.histosys` modifier representing a background\n    with a fully correlated bin-by-bin uncertainty.\n\n    Args:\n        signal (:obj:`list`): The data in the signal sample.\n        bkg (:obj:`list`): The data in the background sample.\n        bkg_up (:obj:`list`): The background sample under an upward variation\n         corresponding to :math:`\\alpha=+1`.\n        bkg_down (:obj:`list`): The background sample under a downward variation\n         corresponding to :math:`\\alpha=-1`.\n        batch_size (:obj:`None` or :obj:`int`): Number of simultaneous (batched) Models to compute.\n\n    Returns:\n        ~pyhf.pdf.Model: The statistical model adhering to the :obj:`model.json` schema.\n\n    Example:\n        >>> import pyhf\n        >>> pyhf.set_backend(\"numpy\")\n        >>> model = pyhf.simplemodels.correlated_background(\n        ...     signal=[12.0, 11.0],\n        ...     bkg=[50.0, 52.0],\n        ...     bkg_up=[45.0, 57.0],\n        ...     bkg_down=[55.0, 47.0],\n        ... )\n        >>> model.schema\n        'model.json'\n        >>> model.config.channels\n        ['single_channel']\n        >>> model.config.samples\n        ['background', 'signal']\n        >>> model.config.parameters\n        ['correlated_bkg_uncertainty', 'mu']\n        >>> model.expected_data(model.config.suggested_init())\n        array([62., 63.,  0.])\n\n    \"\"\"\n    spec = {\n        \"channels\": [\n            {\n                \"name\": \"single_channel\",\n                \"samples\": [\n                    {\n                        \"name\": \"signal\",\n                        \"data\": signal,\n                        \"modifiers\": [\n                            {\"name\": \"mu\", \"type\": \"normfactor\", \"data\": None}\n                        ],\n                    },\n                    {\n                        \"name\": \"background\",\n                        \"data\": bkg,\n                        \"modifiers\": [\n                            {\n                                \"name\": \"correlated_bkg_uncertainty\",\n                                \"type\": \"histosys\",\n                                \"data\": {\"hi_data\": bkg_up, \"lo_data\": bkg_down},\n                            }\n                        ],\n                    },\n                ],\n            }\n        ]\n    }\n    return Model(spec, batch_size=batch_size)\n\n\ndef hepdata_like(signal_data, bkg_data, bkg_uncerts, batch_size=None):\n    \"\"\"\n    Construct a simple single channel :class:`~pyhf.pdf.Model` with a\n    :class:`~pyhf.modifiers.shapesys` modifier representing an uncorrelated\n    background uncertainty.\n\n    Example:\n        >>> import pyhf\n        >>> pyhf.set_backend(\"numpy\")\n        >>> model = pyhf.simplemodels.hepdata_like(\n        ...     signal_data=[12.0, 11.0], bkg_data=[50.0, 52.0], bkg_uncerts=[3.0, 7.0]\n        ... )\n        >>> model.schema\n        'model.json'\n        >>> model.config.channels\n        ['singlechannel']\n        >>> model.config.samples\n        ['background', 'signal']\n        >>> model.config.parameters\n        ['mu', 'uncorr_bkguncrt']\n        >>> model.expected_data(model.config.suggested_init())\n        array([ 62.        ,  63.        , 277.77777778,  55.18367347])\n\n    Args:\n        signal_data (:obj:`list`): The data in the signal sample\n        bkg_data (:obj:`list`): The data in the background sample\n        bkg_uncerts (:obj:`list`): The statistical uncertainty on the background sample counts\n        batch_size (:obj:`None` or :obj:`int`): Number of simultaneous (batched) Models to compute\n\n    Returns:\n        ~pyhf.pdf.Model: The statistical model adhering to the :obj:`model.json` schema\n\n    \"\"\"\n    spec = {\n        'channels': [\n            {\n                'name': 'singlechannel',\n                'samples': [\n                    {\n                        'name': 'signal',\n                        'data': signal_data,\n                        'modifiers': [\n                            {'name': 'mu', 'type': 'normfactor', 'data': None}\n                        ],\n                    },\n                    {\n                        'name': 'background',\n                        'data': bkg_data,\n                        'modifiers': [\n                            {\n                                'name': 'uncorr_bkguncrt',\n                                'type': 'shapesys',\n                                'data': bkg_uncerts,\n                            }\n                        ],\n                    },\n                ],\n            }\n        ]\n    }\n    return Model(spec, batch_size=batch_size)\n", "path": "src/pyhf/simplemodels.py"}]}