prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Document negative `sigma` values in `filters.gaussian_filter` are clipped to zero.
  Negative sigma values have no effect; they are clipped to zero. This should be documented.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `skimage/filters/_gaussian.py`
  Content:
  ```
  1 import collections as coll
  2 import numpy as np
  3 from scipy import ndimage as ndi
  4 import warnings
  5 
  6 from ..util import img_as_float
  7 from ..color import guess_spatial_dimensions
  8 
  9 __all__ = ['gaussian_filter']
  10 
  11 
  12 def gaussian_filter(image, sigma, output=None, mode='nearest', cval=0,
  13                     multichannel=None):
  14     """Multi-dimensional Gaussian filter
  15 
  16     Parameters
  17     ----------
  18     image : array-like
  19         input image (grayscale or color) to filter.
  20     sigma : scalar or sequence of scalars
  21         standard deviation for Gaussian kernel. The standard
  22         deviations of the Gaussian filter are given for each axis as a
  23         sequence, or as a single number, in which case it is equal for
  24         all axes.
  25     output : array, optional
  26         The ``output`` parameter passes an array in which to store the
  27         filter output.
  28     mode : {'reflect', 'constant', 'nearest', 'mirror', 'wrap'}, optional
  29         The `mode` parameter determines how the array borders are
  30         handled, where `cval` is the value when mode is equal to
  31         'constant'. Default is 'nearest'.
  32     cval : scalar, optional
  33         Value to fill past edges of input if `mode` is 'constant'. Default
  34         is 0.0
  35     multichannel : bool, optional (default: None)
  36         Whether the last axis of the image is to be interpreted as multiple
  37         channels. If True, each channel is filtered separately (channels are
  38         not mixed together). Only 3 channels are supported. If `None`,
  39         the function will attempt to guess this, and raise a warning if
  40         ambiguous, when the array has shape (M, N, 3).
  41 
  42     Returns
  43     -------
  44     filtered_image : ndarray
  45         the filtered array
  46 
  47     Notes
  48     -----
  49     This function is a wrapper around :func:`scipy.ndi.gaussian_filter`.
  50 
  51     Integer arrays are converted to float.
  52 
  53     The multi-dimensional filter is implemented as a sequence of
  54     one-dimensional convolution filters. The intermediate arrays are
  55     stored in the same data type as the output. Therefore, for output
  56     types with a limited precision, the results may be imprecise
  57     because intermediate results may be stored with insufficient
  58     precision.
  59 
  60     Examples
  61     --------
  62 
  63     >>> a = np.zeros((3, 3))
  64     >>> a[1, 1] = 1
  65     >>> a
  66     array([[ 0.,  0.,  0.],
  67            [ 0.,  1.,  0.],
  68            [ 0.,  0.,  0.]])
  69     >>> gaussian_filter(a, sigma=0.4)  # mild smoothing
  70     array([[ 0.00163116,  0.03712502,  0.00163116],
  71            [ 0.03712502,  0.84496158,  0.03712502],
  72            [ 0.00163116,  0.03712502,  0.00163116]])
  73     >>> gaussian_filter(a, sigma=1)  # more smooting
  74     array([[ 0.05855018,  0.09653293,  0.05855018],
  75            [ 0.09653293,  0.15915589,  0.09653293],
  76            [ 0.05855018,  0.09653293,  0.05855018]])
  77     >>> # Several modes are possible for handling boundaries
  78     >>> gaussian_filter(a, sigma=1, mode='reflect')
  79     array([[ 0.08767308,  0.12075024,  0.08767308],
  80            [ 0.12075024,  0.16630671,  0.12075024],
  81            [ 0.08767308,  0.12075024,  0.08767308]])
  82     >>> # For RGB images, each is filtered separately
  83     >>> from skimage.data import astronaut
  84     >>> image = astronaut()
  85     >>> filtered_img = gaussian_filter(image, sigma=1, multichannel=True)
  86 
  87     """
  88 
  89     spatial_dims = guess_spatial_dimensions(image)
  90     if spatial_dims is None and multichannel is None:
  91         msg = ("Images with dimensions (M, N, 3) are interpreted as 2D+RGB "
  92                "by default. Use `multichannel=False` to interpret as "
  93                "3D image with last dimension of length 3.")
  94         warnings.warn(RuntimeWarning(msg))
  95         multichannel = True
  96     if multichannel:
  97         # do not filter across channels
  98         if not isinstance(sigma, coll.Iterable):
  99             sigma = [sigma] * (image.ndim - 1)
  100         if len(sigma) != image.ndim:
  101             sigma = np.concatenate((np.asarray(sigma), [0]))
  102     image = img_as_float(image)
  103     return ndi.gaussian_filter(image, sigma, mode=mode, cval=cval)
  104
  ```
  --- 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/skimage/filters/_gaussian.py b/skimage/filters/_gaussian.py
  --- a/skimage/filters/_gaussian.py
  +++ b/skimage/filters/_gaussian.py
  @@ -93,6 +93,8 @@
                  "3D image with last dimension of length 3.")
           warnings.warn(RuntimeWarning(msg))
           multichannel = True
  +    if np.any(np.asarray(sigma) < 0.0):
  +        raise ValueError("Sigma values less than zero are not valid")
       if multichannel:
           # do not filter across channels
           if not isinstance(sigma, coll.Iterable):
  
verification_info: {"golden_diff": "diff --git a/skimage/filters/_gaussian.py b/skimage/filters/_gaussian.py\n--- a/skimage/filters/_gaussian.py\n+++ b/skimage/filters/_gaussian.py\n@@ -93,6 +93,8 @@\n                \"3D image with last dimension of length 3.\")\n         warnings.warn(RuntimeWarning(msg))\n         multichannel = True\n+    if np.any(np.asarray(sigma) < 0.0):\n+        raise ValueError(\"Sigma values less than zero are not valid\")\n     if multichannel:\n         # do not filter across channels\n         if not isinstance(sigma, coll.Iterable):\n", "issue": "Document negative `sigma` values in `filters.gaussian_filter` are clipped to zero.\nNegative sigma values have no effect; they are clipped to zero. This should be documented.\n\n", "before_files": [{"content": "import collections as coll\nimport numpy as np\nfrom scipy import ndimage as ndi\nimport warnings\n\nfrom ..util import img_as_float\nfrom ..color import guess_spatial_dimensions\n\n__all__ = ['gaussian_filter']\n\n\ndef gaussian_filter(image, sigma, output=None, mode='nearest', cval=0,\n                    multichannel=None):\n    \"\"\"Multi-dimensional Gaussian filter\n\n    Parameters\n    ----------\n    image : array-like\n        input image (grayscale or color) to filter.\n    sigma : scalar or sequence of scalars\n        standard deviation for Gaussian kernel. The standard\n        deviations of the Gaussian filter are given for each axis as a\n        sequence, or as a single number, in which case it is equal for\n        all axes.\n    output : array, optional\n        The ``output`` parameter passes an array in which to store the\n        filter output.\n    mode : {'reflect', 'constant', 'nearest', 'mirror', 'wrap'}, optional\n        The `mode` parameter determines how the array borders are\n        handled, where `cval` is the value when mode is equal to\n        'constant'. Default is 'nearest'.\n    cval : scalar, optional\n        Value to fill past edges of input if `mode` is 'constant'. Default\n        is 0.0\n    multichannel : bool, optional (default: None)\n        Whether the last axis of the image is to be interpreted as multiple\n        channels. If True, each channel is filtered separately (channels are\n        not mixed together). Only 3 channels are supported. If `None`,\n        the function will attempt to guess this, and raise a warning if\n        ambiguous, when the array has shape (M, N, 3).\n\n    Returns\n    -------\n    filtered_image : ndarray\n        the filtered array\n\n    Notes\n    -----\n    This function is a wrapper around :func:`scipy.ndi.gaussian_filter`.\n\n    Integer arrays are converted to float.\n\n    The multi-dimensional filter is implemented as a sequence of\n    one-dimensional convolution filters. The intermediate arrays are\n    stored in the same data type as the output. Therefore, for output\n    types with a limited precision, the results may be imprecise\n    because intermediate results may be stored with insufficient\n    precision.\n\n    Examples\n    --------\n\n    >>> a = np.zeros((3, 3))\n    >>> a[1, 1] = 1\n    >>> a\n    array([[ 0.,  0.,  0.],\n           [ 0.,  1.,  0.],\n           [ 0.,  0.,  0.]])\n    >>> gaussian_filter(a, sigma=0.4)  # mild smoothing\n    array([[ 0.00163116,  0.03712502,  0.00163116],\n           [ 0.03712502,  0.84496158,  0.03712502],\n           [ 0.00163116,  0.03712502,  0.00163116]])\n    >>> gaussian_filter(a, sigma=1)  # more smooting\n    array([[ 0.05855018,  0.09653293,  0.05855018],\n           [ 0.09653293,  0.15915589,  0.09653293],\n           [ 0.05855018,  0.09653293,  0.05855018]])\n    >>> # Several modes are possible for handling boundaries\n    >>> gaussian_filter(a, sigma=1, mode='reflect')\n    array([[ 0.08767308,  0.12075024,  0.08767308],\n           [ 0.12075024,  0.16630671,  0.12075024],\n           [ 0.08767308,  0.12075024,  0.08767308]])\n    >>> # For RGB images, each is filtered separately\n    >>> from skimage.data import astronaut\n    >>> image = astronaut()\n    >>> filtered_img = gaussian_filter(image, sigma=1, multichannel=True)\n\n    \"\"\"\n\n    spatial_dims = guess_spatial_dimensions(image)\n    if spatial_dims is None and multichannel is None:\n        msg = (\"Images with dimensions (M, N, 3) are interpreted as 2D+RGB \"\n               \"by default. Use `multichannel=False` to interpret as \"\n               \"3D image with last dimension of length 3.\")\n        warnings.warn(RuntimeWarning(msg))\n        multichannel = True\n    if multichannel:\n        # do not filter across channels\n        if not isinstance(sigma, coll.Iterable):\n            sigma = [sigma] * (image.ndim - 1)\n        if len(sigma) != image.ndim:\n            sigma = np.concatenate((np.asarray(sigma), [0]))\n    image = img_as_float(image)\n    return ndi.gaussian_filter(image, sigma, mode=mode, cval=cval)\n", "path": "skimage/filters/_gaussian.py"}], "after_files": [{"content": "import collections as coll\nimport numpy as np\nfrom scipy import ndimage as ndi\nimport warnings\n\nfrom ..util import img_as_float\nfrom ..color import guess_spatial_dimensions\n\n__all__ = ['gaussian_filter']\n\n\ndef gaussian_filter(image, sigma, output=None, mode='nearest', cval=0,\n                    multichannel=None):\n    \"\"\"Multi-dimensional Gaussian filter\n\n    Parameters\n    ----------\n    image : array-like\n        input image (grayscale or color) to filter.\n    sigma : scalar or sequence of scalars\n        standard deviation for Gaussian kernel. The standard\n        deviations of the Gaussian filter are given for each axis as a\n        sequence, or as a single number, in which case it is equal for\n        all axes.\n    output : array, optional\n        The ``output`` parameter passes an array in which to store the\n        filter output.\n    mode : {'reflect', 'constant', 'nearest', 'mirror', 'wrap'}, optional\n        The `mode` parameter determines how the array borders are\n        handled, where `cval` is the value when mode is equal to\n        'constant'. Default is 'nearest'.\n    cval : scalar, optional\n        Value to fill past edges of input if `mode` is 'constant'. Default\n        is 0.0\n    multichannel : bool, optional (default: None)\n        Whether the last axis of the image is to be interpreted as multiple\n        channels. If True, each channel is filtered separately (channels are\n        not mixed together). Only 3 channels are supported. If `None`,\n        the function will attempt to guess this, and raise a warning if\n        ambiguous, when the array has shape (M, N, 3).\n\n    Returns\n    -------\n    filtered_image : ndarray\n        the filtered array\n\n    Notes\n    -----\n    This function is a wrapper around :func:`scipy.ndi.gaussian_filter`.\n\n    Integer arrays are converted to float.\n\n    The multi-dimensional filter is implemented as a sequence of\n    one-dimensional convolution filters. The intermediate arrays are\n    stored in the same data type as the output. Therefore, for output\n    types with a limited precision, the results may be imprecise\n    because intermediate results may be stored with insufficient\n    precision.\n\n    Examples\n    --------\n\n    >>> a = np.zeros((3, 3))\n    >>> a[1, 1] = 1\n    >>> a\n    array([[ 0.,  0.,  0.],\n           [ 0.,  1.,  0.],\n           [ 0.,  0.,  0.]])\n    >>> gaussian_filter(a, sigma=0.4)  # mild smoothing\n    array([[ 0.00163116,  0.03712502,  0.00163116],\n           [ 0.03712502,  0.84496158,  0.03712502],\n           [ 0.00163116,  0.03712502,  0.00163116]])\n    >>> gaussian_filter(a, sigma=1)  # more smooting\n    array([[ 0.05855018,  0.09653293,  0.05855018],\n           [ 0.09653293,  0.15915589,  0.09653293],\n           [ 0.05855018,  0.09653293,  0.05855018]])\n    >>> # Several modes are possible for handling boundaries\n    >>> gaussian_filter(a, sigma=1, mode='reflect')\n    array([[ 0.08767308,  0.12075024,  0.08767308],\n           [ 0.12075024,  0.16630671,  0.12075024],\n           [ 0.08767308,  0.12075024,  0.08767308]])\n    >>> # For RGB images, each is filtered separately\n    >>> from skimage.data import astronaut\n    >>> image = astronaut()\n    >>> filtered_img = gaussian_filter(image, sigma=1, multichannel=True)\n\n    \"\"\"\n\n    spatial_dims = guess_spatial_dimensions(image)\n    if spatial_dims is None and multichannel is None:\n        msg = (\"Images with dimensions (M, N, 3) are interpreted as 2D+RGB \"\n               \"by default. Use `multichannel=False` to interpret as \"\n               \"3D image with last dimension of length 3.\")\n        warnings.warn(RuntimeWarning(msg))\n        multichannel = True\n    if np.any(np.asarray(sigma) < 0.0):\n        raise ValueError(\"Sigma values less than zero are not valid\")\n    if multichannel:\n        # do not filter across channels\n        if not isinstance(sigma, coll.Iterable):\n            sigma = [sigma] * (image.ndim - 1)\n        if len(sigma) != image.ndim:\n            sigma = np.concatenate((np.asarray(sigma), [0]))\n    image = img_as_float(image)\n    return ndi.gaussian_filter(image, sigma, mode=mode, cval=cval)\n", "path": "skimage/filters/_gaussian.py"}]}