internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: scipy/scipy

Issue:
documentation for `scipy.interpolate.RectBivariateSpline` is unclear
The documentation for `scipy.interpolate.RectBivariateSpline` is unclear re. the following:

(1) What happens when the coordinates passed to `__call__` exceed the limits of the input code?  Is extrapolation being done?

(2) The documentation says that the default `bbox` is `[min(x,tx),max(x,tx), min(y,ty),max(y,ty)]`, but `tx` and `ty` are not defined.
documentation for `scipy.interpolate.RectBivariateSpline` is unclear
The documentation for `scipy.interpolate.RectBivariateSpline` is unclear re. the following:

(1) What happens when the coordinates passed to `__call__` exceed the limits of the input code?  Is extrapolation being done?

(2) The documentation says that the default `bbox` is `[min(x,tx),max(x,tx), min(y,ty),max(y,ty)]`, but `tx` and `ty` are not defined.


Discussion:
Steps to solve this one:
* Learn what `scipy.interpolate.RectBivariateSpline` does and how the algorithm should work
* Investigate the code (click "source" at the [documentation](http://scipy.github.io/devdocs/reference/generated/scipy.interpolate.RectBivariateSpline.html#scipy.interpolate.RectBivariateSpline)) to answer the questions above 
* Propose documentation changes to address the questions (citing relevant code, references, etc.)

Hello. I'd like to help with this issue.
Second point was already solved in #12463
Steps to solve this one:
* Learn what `scipy.interpolate.RectBivariateSpline` does and how the algorithm should work
* Investigate the code (click "source" at the [documentation](http://scipy.github.io/devdocs/reference/generated/scipy.interpolate.RectBivariateSpline.html#scipy.interpolate.RectBivariateSpline)) to answer the questions above 
* Propose documentation changes to address the questions (citing relevant code, references, etc.)

Hello. I'd like to help with this issue.
Second point was already solved in #12463

Resolving patch:
diff --git a/scipy/interpolate/_fitpack2.py b/scipy/interpolate/_fitpack2.py
--- a/scipy/interpolate/_fitpack2.py
+++ b/scipy/interpolate/_fitpack2.py
@@ -1285,11 +1285,13 @@ class RectBivariateSpline(BivariateSpline):
     ----------
     x,y : array_like
         1-D arrays of coordinates in strictly ascending order.
+        Evaluated points outside the data range will be extrapolated.
     z : array_like
         2-D array of data with shape (x.size,y.size).
     bbox : array_like, optional
         Sequence of length 4 specifying the boundary of the rectangular
-        approximation domain.  By default,
+        approximation domain, which means the start and end spline knots of
+        each dimension are set by these values. By default,
         ``bbox=[min(x), max(x), min(y), max(y)]``.
     kx, ky : ints, optional
         Degrees of the bivariate spline. Default is 3.


Test patch:
Repository: scipy/scipy

Issue:
`integrate.quad_vec` missing documentation for `limit` parameter
The `limit=1000`  parameter is included in the function signature but not documented. It is not clear that this functions in the same way as the parameter with the same name for `integrate.quad` (I do not seem to be able to trigger a warning for the limit being reached by setting a low value e.g. `limit=1`). Note also #12216.


Discussion:

Resolving patch:
diff --git a/scipy/integrate/_quad_vec.py b/scipy/integrate/_quad_vec.py
--- a/scipy/integrate/_quad_vec.py
+++ b/scipy/integrate/_quad_vec.py
@@ -122,6 +122,9 @@ def quad_vec(f, a, b, epsabs=1e-200, epsrel=1e-8, norm='2', cache_size=100e6, li
         Vector norm to use for error estimation.
     cache_size : int, optional
         Number of bytes to use for memoization.
+    limit : float or int, optional
+        An upper bound on the number of subintervals used in the adaptive
+        algorithm.
     workers : int or map-like callable, optional
         If `workers` is an integer, part of the computation is done in
         parallel subdivided to this many tasks (using


Test patch:
Repository: scipy/scipy

Issue:
ENH: Update documentation on scipy.signal.butter regarding the correctness of the term "order"
IMO the term "order" in the docs for `scipy.signal.butter` is misleading in case of bandpass-filters. Discussion is located [here](https://dsp.stackexchange.com/questions/81285/sanity-check-does-python-or-i-not-understand-sos-matrices)

Based on documentation [here](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.butter.html)


Discussion:
Hi @jake-is-ESD-protected, thank you for reporting. Documentation improvement are always welcome. Would you like to make a PR?
@tupui Where do i edit the documentation after cloning?
@jake-is-ESD-protected I suppose this is the documentation here that you want to update https://github.com/scipy/scipy/blob/v1.7.1/scipy/signal/filter_design.py#L2846-L2957

Resolving patch:
diff --git a/scipy/signal/_filter_design.py b/scipy/signal/_filter_design.py
--- a/scipy/signal/_filter_design.py
+++ b/scipy/signal/_filter_design.py
@@ -2942,7 +2942,10 @@ def butter(N, Wn, btype='low', analog=False, output='ba', fs=None):
     Parameters
     ----------
     N : int
-        The order of the filter.
+        The order of the filter. For 'bandpass' and 'bandstop' filters,
+        the resulting order of the final second-order sections ('sos')
+        matrix is ``2*N``, with `N` the number of biquad sections
+        of the desired system.
     Wn : array_like
         The critical frequency or frequencies. For lowpass and highpass
         filters, Wn is a scalar; for bandpass and bandstop filters,


Test patch:
Repository: scipy/scipy

Issue:
DOC: Documentation inaccuracy of scipy.interpolate.bisplev
### Is your feature request related to a problem? Please describe.

Documentation for scipy.interpolate.bisplev at https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.bisplev.html should be improved. The implementation of bisplev in scipy does not only rely on **bisplev** of fitpack, it also relies on **parder** of fitpack when the order of derivative(s) of the evaluation is non-zero (i.e., dx /=0 or dy /= 0 in scipy's bisplev functon). 


### Describe the solution you'd like.

The documentation should be revised from 
**Based on BISPEV from FITPACK.**
to 
**Based on BISPEV and PARDER from FITPACK.**

### Describe alternatives you've considered.

_No response_

### Additional context (e.g. screenshots, GIFs)

_No response_


Discussion:
Hi @kaigaox, thank you for reporting. We welcome contributions which seek to improve the documentation. Feel free to open a PR.
Where is parder used?
> Where is parder used?

https://github.com/scipy/scipy/blob/8a64c938ddf1ae4c02a08d2c5e38daeb8d061d38/scipy/interpolate/src/_fitpackmodule.c

Line 221-228:
`    if (nux || nuy) {
        PARDER(tx, &nx, ty, &ny, c, &kx, &ky, &nux, &nuy, x, &mx, y, &my, z,
                wrk, &lwrk, iwrk, &kwrk, &ier);
    }
    else {
        BISPEV(tx, &nx, ty, &ny, c, &kx, &ky, x, &mx, y, &my, z, wrk, &lwrk,
                iwrk, &kwrk, &ier);
    }`

Resolving patch:
diff --git a/scipy/interpolate/_fitpack_impl.py b/scipy/interpolate/_fitpack_impl.py
--- a/scipy/interpolate/_fitpack_impl.py
+++ b/scipy/interpolate/_fitpack_impl.py
@@ -996,7 +996,7 @@ def bisplev(x, y, tck, dx=0, dy=0):
     Return a rank-2 array of spline function values (or spline derivative
     values) at points given by the cross-product of the rank-1 arrays `x` and
     `y`.  In special cases, return an array or just a float if either `x` or
-    `y` or both are floats.  Based on BISPEV from FITPACK.
+    `y` or both are floats.  Based on BISPEV and PARDER from FITPACK.
 
     Parameters
     ----------


Test patch:
Repository: scipy/scipy

Issue:
BUG: `scipy.spatial.transform.rotation`, wrong deprecation or missing `Rotation` in `scipy.spatial`
### Describe your issue.

With the new `scipy=1.8.0` release, when importing `Rotation` from `scipy.spatial.transform.rotation` , a new deprecation message states:

```
DeprecationWarning: Please use `Rotation` from the `scipy.spatial` namespace, the `scipy.spatial.transform.rotation` namespace is deprecated.
  from scipy.spatial.transform.rotation import Rotation
```

Problem:

There is no `Rotation` in the `scipy.spatial` namespace.


### Reproducing Code Example

```python
from scipy.spatial import Rotation
```


### Error message

```shell
cannot import name 'Rotation' from 'scipy.spatial'
```
```


### SciPy/NumPy/Python version information

1.8.0 1.20.3 sys.version_info(major=3, minor=9, micro=5, releaselevel='final', serial=0)


Discussion:
It's possible the warning message is incorrect. This pr (gh-14923) deprecated the `spatial.transform.rotation` namespace, but you can still import `Rotation` from `transform`. 

It looks like this is where `Rotation` is actually located if you need it now: 

`from scipy.spatial.transform import Rotation`
~I think the message is actually telling it right: `from scipy.spatial.transform.rotation import Rotation` maybe a non needed `rotation` but otherwise it's correct.~
I suppose the message is technically correct, since Rotation is in the transform submodule of the spatial namespace. I do think the warning message is a bit vague since it's not entirely clear that it is the `.rotation` rather than `.transform.rotation` that is to be deprecated.
Oh right, I misread it. Agreed we should change this.

Resolving patch:
diff --git a/scipy/spatial/transform/rotation.py b/scipy/spatial/transform/rotation.py
--- a/scipy/spatial/transform/rotation.py
+++ b/scipy/spatial/transform/rotation.py
@@ -25,8 +25,9 @@ def __getattr__(name):
             "scipy.spatial.transform.rotation is deprecated and has no attribute "
             f"{name}. Try looking in scipy.spatial instead.")
 
-    warnings.warn(f"Please use `{name}` from the `scipy.spatial` namespace, "
-                  "the `scipy.spatial.transform.rotation` namespace is deprecated.",
+    warnings.warn(f"Please use `{name}` from the `scipy.spatial.transform` "
+                  "namespace, the `scipy.spatial.transform.rotation` namespace"
+                  " is deprecated.",
                   category=DeprecationWarning, stacklevel=2)
 
     return getattr(_rotation, name)


Test patch:
Repository: scipy/scipy

Issue:
BUG: scipy.special.factorialk docstring inconsistent with behaviour
### Describe your issue.

The docstring for scipy.special.factorialk states: Calculate multifactorial. If n < 0, the return value is 0. However the code actually returns 0 if `n < 1 - k` else 1 if  `n <= 0`

### Reproducing Code Example

```python
>>> factorialk(-5,1)
0
>>> factorialk(-1,3)
1
```


### Error message

```shell
None
```


### SciPy/NumPy/Python version information

1.9.0.dev0+1479.321a18f 1.21.2 sys.version_info(major=3, minor=8, micro=12, releaselevel='final', serial=0)


Discussion:

Resolving patch:
diff --git a/scipy/special/_basic.py b/scipy/special/_basic.py
--- a/scipy/special/_basic.py
+++ b/scipy/special/_basic.py
@@ -2463,7 +2463,8 @@ def factorialk(n, k, exact=True):
     Parameters
     ----------
     n : int
-        Calculate multifactorial. If `n` < 0, the return value is 0.
+        Calculate multifactorial. If ``n < 1 - k``, the return value is 0.
+        Otherwise if ``n <= 0``, the return value is 1.
     k : int
         Order of multifactorial.
     exact : bool, optional


Test patch:
Repository: scipy/scipy

Issue:
BUG:  DOCS incorrect `source` link on docs
### Describe your issue.

When I click `source` on [mannwhitenyu](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.mannwhitneyu.html), <img width="882" alt="Screen Shot 2022-02-21 at 9 34 21 PM" src="https://user-images.githubusercontent.com/44255917/155069433-c894cadc-60c0-488f-8101-6abd9122a6ca.png">

it takes me here, https://github.com/scipy/scipy/blob/b5d8bab88af61d61de09641243848df63380a67f/scipy/stats/_axis_nan_policy.py#L181
 to the NaN policy functions.

when I think it should probably be here:
https://github.com/scipy/scipy/blob/b5d8bab88af61d61de09641243848df63380a67f/scipy/stats/_mannwhitneyu.py#L182

The same thing happens with [Wilcoxon](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.wilcoxon.html?highlight=wilcox#scipy-stats-wilcoxon), but I haven't look extensively for others with the same issue


### Reproducing Code Example

```python
N/a
```


### Error message

```shell
N/a
```


### SciPy/NumPy/Python version information

1.8 docs online 


Discussion:
Yes, this is something I've noticed - Sphinx doesn't know how to find the original function to which a decorator was applied. I've meant to figure out some way of telling it where to go manually. @tirthasheshpatel any thoughts?

There are a few other issues I noticed with the `[source]` link:

- It's missing for all the `scipy.stats.sampling` classes.
- It doesn't know what lines distributions classes are defined on.

Resolving patch:
diff --git a/doc/source/conf.py b/doc/source/conf.py
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -20,6 +20,8 @@
 # ua._Function should not be treated as an attribute
 from sphinx.util import inspect
 import scipy._lib.uarray as ua
+from scipy.stats._distn_infrastructure import rv_generic  # noqa: E402
+from scipy.stats._multivariate import multi_rv_generic  # noqa: E402
 old_isdesc = inspect.isdescriptor
 inspect.isdescriptor = (lambda obj: old_isdesc(obj)
                         and not isinstance(obj, ua._Function))
@@ -470,6 +472,12 @@ def linkcode_resolve(domain, info):
         except Exception:
             return None
 
+    # Use the original function object if it is wrapped.
+    obj = getattr(obj, "__wrapped__", obj)
+    # SciPy's distributions are instances of *_gen. Point to this
+    # class since it contains the implementation of all the methods.
+    if isinstance(obj, (rv_generic, multi_rv_generic)):
+        obj = obj.__class__
     try:
         fn = inspect.getsourcefile(obj)
     except Exception:


Test patch:
Repository: scipy/scipy

Issue:
CI: scipy.scipy (Main refguide_asv_check) failure in main
CI Failure in main (e.g. gh-15652).

```python3
Checking tutorial files at doc/source/tutorial/*.rst:

============
scipy.signal
============

scipy.signal.bohman
-------------------

File "build/testenv/lib/python3.9/site-packages/scipy/signal/__init__.py", line 412, in bohman
Failed example:
    np.seterr(divide='ignore')
Expected nothing
Got:
    {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'}

scipy.signal.cosine
-------------------

File "build/testenv/lib/python3.9/site-packages/scipy/signal/__init__.py", line 417, in cosine
Failed example:
    np.seterr(divide='ignore')
Expected nothing
Got:
    {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'}


====================
scipy.signal.windows
====================

scipy.signal.windows.bohman
---------------------------

File "build/testenv/lib/python3.9/site-packages/scipy/signal/windows/_windows.py", line 339, in bohman
Failed example:
    np.seterr(divide='ignore')
Expected nothing
Got:
    {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'}

scipy.signal.windows.cosine
---------------------------

File "build/testenv/lib/python3.9/site-packages/scipy/signal/windows/_windows.py", line 1603, in cosine
Failed example:
    np.seterr(divide='ignore')
Expected nothing
Got:
    {'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'}

ERROR: refguide or doctests have errors

```


Discussion:

Resolving patch:
diff --git a/scipy/signal/windows/_windows.py b/scipy/signal/windows/_windows.py
--- a/scipy/signal/windows/_windows.py
+++ b/scipy/signal/windows/_windows.py
@@ -336,7 +336,6 @@ def bohman(M, sym=True):
     >>> plt.figure()
     >>> A = fft(window, 2048) / (len(window)/2.0)
     >>> freq = np.linspace(-0.5, 0.5, len(A))
-    >>> np.seterr(divide='ignore')
     >>> response = 20 * np.log10(np.abs(fftshift(A / abs(A).max())))
     >>> plt.plot(freq, response)
     >>> plt.axis([-0.5, 0.5, -120, 0])
@@ -1600,7 +1599,6 @@ def cosine(M, sym=True):
     >>> plt.figure()
     >>> A = fft(window, 2048) / (len(window)/2.0)
     >>> freq = np.linspace(-0.5, 0.5, len(A))
-    >>> np.seterr(divide='ignore')
     >>> response = 20 * np.log10(np.abs(fftshift(A / abs(A).max())))
     >>> plt.plot(freq, response)
     >>> plt.axis([-0.5, 0.5, -120, 0])


Test patch:
Repository: scipy/scipy

Issue:
DEP: extradoc in _distn_infrastructure
It's been 10 years since extradoc has been deprecated, although in documentation only: https://github.com/scipy/scipy/commit/eb90ace863f0538dcacb67bcf246918037dc298b, see https://github.com/scipy/scipy/blob/v1.8.0/scipy/stats/_distn_infrastructure.py#L1564-L1567 for current location.

Should we add a warning? Just remove the documentation that it's deprecated?




Discussion:
The only use of `extradoc` that I can find outside of `_distn_infrastructure` is the [following](https://github.com/scipy/scipy/blob/v1.8.0/scipy/stats/tests/test_distributions.py#L4721-L4724), which refers to #1842.

`gamma_gen` nowadays [uses](https://github.com/scipy/scipy/blame/v1.8.0/scipy/stats/_continuous_distns.py#L2701) [`@extend_notes_in_docstring`](https://github.com/scipy/scipy/blob/v1.8.0/scipy/_lib/doccer.py#L126), where `extradoc` doesn't appear. I think we can definitely deprecate it.

Resolving patch:
diff --git a/scipy/stats/_distn_infrastructure.py b/scipy/stats/_distn_infrastructure.py
--- a/scipy/stats/_distn_infrastructure.py
+++ b/scipy/stats/_distn_infrastructure.py
@@ -1921,6 +1921,10 @@ def __init__(self, momtype=1, a=None, b=None, xtol=1e-14,
 
         super().__init__(seed)
 
+        if extradoc is not None:
+            warnings.warn("extradoc is deprecated and will be removed in "
+                          "SciPy 1.11.0", DeprecationWarning)
+
         # save the ctor parameters, cf generic freeze
         self._ctor_param = dict(
             momtype=momtype, a=a, b=b, xtol=xtol,
@@ -3048,7 +3052,7 @@ class rv_discrete(rv_generic):
         If not provided, shape parameters will be inferred from
         the signatures of the private methods, ``_pmf`` and ``_cdf`` of
         the instance.
-    extradoc :  str, optional
+    extradoc :  str, optional, deprecated
         This string is used as the last part of the docstring returned when a
         subclass has no docstring of its own. Note: `extradoc` exists for
         backwards compatibility, do not use for new subclasses.
@@ -3159,6 +3163,10 @@ def __init__(self, a=0, b=inf, name=None, badvalue=None,
 
         super().__init__(seed)
 
+        if extradoc is not None:
+            warnings.warn("extradoc is deprecated and will be removed in "
+                          "SciPy 1.11.0", DeprecationWarning)
+
         # cf generic freeze
         self._ctor_param = dict(
             a=a, b=b, name=name, badvalue=badvalue,
@@ -3839,6 +3847,10 @@ def __init__(self, a=0, b=inf, name=None, badvalue=None,
 
         super(rv_discrete, self).__init__(seed)
 
+        if extradoc is not None:
+            warnings.warn("extradoc is deprecated and will be removed in "
+                          "SciPy 1.11.0", DeprecationWarning)
+
         if values is None:
             raise ValueError("rv_sample.__init__(..., values=None,...)")
 


Test patch:
Repository: scipy/scipy

Issue:
DEP: sharpen deprecation for >1-dim inputs in optimize.minimize
This comes from #15297, which only landed for 1.9. Currently the message of the deprecation warning is a bit soft:
```
Use of `minimize` with `x0.ndim != 1` is deprecated. Currently, singleton dimensions
will be removed from `x0`, but an error may be raised in the future.
```

Can we sharpen this to say that an error _will_ be raised in version X? (1.11? 1.12?)

CC @mdhaber 


Discussion:
That is fine with me.

Resolving patch:
diff --git a/scipy/optimize/_minimize.py b/scipy/optimize/_minimize.py
--- a/scipy/optimize/_minimize.py
+++ b/scipy/optimize/_minimize.py
@@ -518,7 +518,7 @@ def minimize(fun, x0, args=(), method=None, jac=None, hess=None,
     if x0.ndim != 1:
         message = ('Use of `minimize` with `x0.ndim != 1` is deprecated. '
                    'Currently, singleton dimensions will be removed from '
-                   '`x0`, but an error may be raised in the future.')
+                   '`x0`, but an error will be raised in SciPy 1.11.0.')
         warn(message, DeprecationWarning, stacklevel=2)
         x0 = np.squeeze(x0)
 


Test patch:
Repository: scipy/scipy

Issue:
DEP: sharpen deprecation of dual_annealing argument 'local_search_options'
Deprecated since https://github.com/scipy/scipy/pull/13392 (though the warning doesn't specify a clear removal date):
```
dual_annealing argument 'local_search_options' is deprecated in favor of 'minimizer_kwargs'
```
I think this would be eligible for removal in 1.10 (or 1.11?); we should sharpen the warning for 1.9.

CC @andyfaff 


Discussion:

Resolving patch:
diff --git a/scipy/optimize/_dual_annealing.py b/scipy/optimize/_dual_annealing.py
--- a/scipy/optimize/_dual_annealing.py
+++ b/scipy/optimize/_dual_annealing.py
@@ -521,6 +521,10 @@ def dual_annealing(func, bounds, args=(), maxiter=1000,
         Backwards compatible flag for `minimizer_kwargs`, only one of these
         should be supplied.
 
+        .. deprecated:: 1.8.0
+            dual_annealing argument `local_search_options` is deprecated in
+            favor of `minimizer_kwargs` and will be removed in SciPy 1.10.0.
+
     Returns
     -------
     res : OptimizeResult
@@ -650,7 +654,8 @@ def dual_annealing(func, bounds, args=(), maxiter=1000,
                          "'local_search_options' (deprecated); not both!")
     if local_search_options is not None:
         warnings.warn("dual_annealing argument 'local_search_options' is "
-                      "deprecated in favor of 'minimizer_kwargs'",
+                      "deprecated in favor of 'minimizer_kwargs' and will be "
+                      "removed in SciPy 1.10.0.",
                       category=DeprecationWarning, stacklevel=2)
         minimizer_kwargs = local_search_options
 


Test patch: