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

Issue:
Noncentral Chi squared has incorrect PDF
According to the scipy documentation, it calculates the pdf of the noncentral chi-squared as 
ncx2.pdf(x, df, nc) = exp(-(nc+df)/2) \* 1/2 \* (x/nc)*_((df-2)/4) \* I[(df-2)/2](sqrt(nc_x))
Whereas it should be 
ncx2.pdf(x, df, nc) = exp(-(nc+x)/2) \* 1/2 \* (x/nc)*_((df-2)/4) \* I[(df-2)/2](sqrt(nc_x))
(replace df with x in "exp")
according to http://mathworld.wolfram.com/NoncentralChi-SquaredDistribution.html and 
http://en.wikipedia.org/wiki/Noncentral_chi-squared_distribution
![image](https://cloud.githubusercontent.com/assets/313774/4709313/59c9664e-589e-11e4-8b5c-7fcd669fc8cc.png)



Discussion:
seems to be fixed in master
https://github.com/scipy/scipy/blob/master/scipy/stats/_distn_infrastructure.py#L592

which version of scipy are you looking at

Nice! Thanks!
I was looking at the doc here: http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.ncx2.html#scipy.stats.ncx2
must be outdated.

I think the docstring still has the typo in the formula


Resolving patch:
diff --git a/scipy/stats/_continuous_distns.py b/scipy/stats/_continuous_distns.py
--- a/scipy/stats/_continuous_distns.py
+++ b/scipy/stats/_continuous_distns.py
@@ -1407,7 +1407,7 @@ class genpareto_gen(rv_continuous):
 
         genpareto.pdf(x, c) = (1 + c * x)**(-1 - 1/c)
 
-    defined for ``x >= 0`` if ``c >=0``, and for 
+    defined for ``x >= 0`` if ``c >=0``, and for
     ``0 <= x <= -1/c`` if ``c < 0``.
 
     For ``c == 0``, `genpareto` reduces to the exponential
@@ -1525,8 +1525,8 @@ class genextreme_gen(rv_continuous):
             exp(-exp(-x))*exp(-x),                    for c==0
             exp(-(1-c*x)**(1/c))*(1-c*x)**(1/c-1),    for x <= 1/c, c > 0
 
-    Note that several sources and software packages use the opposite 
-    convention for the sign of the shape parameter ``c``. 
+    Note that several sources and software packages use the opposite
+    convention for the sign of the shape parameter ``c``.
 
     %(example)s
 
@@ -2921,7 +2921,7 @@ class ncx2_gen(rv_continuous):
     -----
     The probability density function for `ncx2` is::
 
-        ncx2.pdf(x, df, nc) = exp(-(nc+df)/2) * 1/2 * (x/nc)**((df-2)/4)
+        ncx2.pdf(x, df, nc) = exp(-(nc+x)/2) * 1/2 * (x/nc)**((df-2)/4)
                               * I[(df-2)/2](sqrt(nc*x))
 
     for ``x > 0``.


Test patch:
Repository: scipy/scipy

Issue:
Bug in expm for integer arrays
E.g.

```
a = np.array([[1, 2], [2, 0]])
from scipy.linalg import expm
expm(a)
```

```
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-40-3b9333686cdf> in <module>()
      1 a = np.array([[1, 2], [2, 0]])
      2 from scipy.linalg import expm
----> 3 expm(a)

/Users/cournape/.envs/master-dev/lib/python2.7/site-packages/scipy/linalg/matfuncs.pyc in expm(A, q)
    171     # Input checking and conversion is provided by sparse.linalg.expm().
    172     import scipy.sparse.linalg
--> 173     return scipy.sparse.linalg.expm(A)
    174 
    175 

/Users/cournape/.envs/master-dev/lib/python2.7/site-packages/scipy/sparse/linalg/matfuncs.pyc in expm(A)
    619     theta_13 = 4.25
    620     s = max(int(np.ceil(np.log2(eta_5 / theta_13))), 0)
--> 621     s = s + _ell(2**-s * h.A, 13)
    622     U, V = h.pade13_scaled(s)
    623     X = _solve_P_Q(U, V, structure=structure)

/Users/cournape/.envs/master-dev/lib/python2.7/site-packages/scipy/sparse/linalg/matfuncs.pyc in _ell(A, m)
    806 
    807     alpha = A_abs_onenorm / (_onenorm(A) * abs_c_recip)
--> 808     log2_alpha_div_u = np.log2(alpha/u)
    809     value = int(np.ceil(log2_alpha_div_u / (2 * m)))
    810     return max(value, 0)

AttributeError: log2
```



Discussion:

Resolving patch:
diff --git a/scipy/sparse/linalg/matfuncs.py b/scipy/sparse/linalg/matfuncs.py
--- a/scipy/sparse/linalg/matfuncs.py
+++ b/scipy/sparse/linalg/matfuncs.py
@@ -791,7 +791,8 @@ def _ell(A, m):
 
     # The c_i are explained in (2.2) and (2.6) of the 2005 expm paper.
     # They are coefficients of terms of a generating function series expansion.
-    abs_c_recip = scipy.misc.comb(2*p, p, exact=True) * math.factorial(2*p + 1)
+    choose_2p_p = scipy.misc.comb(2*p, p, exact=True)
+    abs_c_recip = float(choose_2p_p * math.factorial(2*p + 1))
 
     # This is explained after Eq. (1.2) of the 2009 expm paper.
     # It is the "unit roundoff" of IEEE double precision arithmetic.


Test patch:
diff --git a/scipy/sparse/linalg/tests/test_matfuncs.py b/scipy/sparse/linalg/tests/test_matfuncs.py
--- a/scipy/sparse/linalg/tests/test_matfuncs.py
+++ b/scipy/sparse/linalg/tests/test_matfuncs.py
@@ -159,6 +159,14 @@ def test_logm_consistency(self):
                         A = A + 1j * random.rand(n, n) * scale
                     assert_array_almost_equal(expm(logm(A)), A)
 
+    def test_integer_matrix(self):
+        Q = np.array([
+            [-3, 1, 1, 1],
+            [1, -3, 1, 1],
+            [1, 1, -3, 1],
+            [1, 1, 1, -3]])
+        assert_allclose(expm(Q), expm(1.0 * Q))
+
     def test_triangularity_perturbation(self):
         # Experiment (1) of
         # Awad H. Al-Mohy and Nicholas J. Higham (2012)
Repository: scipy/scipy

Issue:
scipy.optimize.newton_krylov() ignores norm_tol argument
I am trying to use `scipy.optimize.newton_krylov()` and the argument `norm_tol`. But the passed function is never called.

Looking at sources (https://github.com/scipy/scipy/blob/v0.14.0/scipy/optimize/nonlin.py#L448), it seems that the line `self.norm = maxnorm` should be `self.norm = norm` to have the correct behavior.



Discussion:
I'll have a go at this.


Resolving patch:
diff --git a/scipy/optimize/nonlin.py b/scipy/optimize/nonlin.py
--- a/scipy/optimize/nonlin.py
+++ b/scipy/optimize/nonlin.py
@@ -445,7 +445,11 @@ def __init__(self, f_tol=None, f_rtol=None, x_tol=None, x_rtol=None,
         self.f_tol = f_tol
         self.f_rtol = f_rtol
 
-        self.norm = maxnorm
+        if norm is None:
+            self.norm = maxnorm
+        else:
+            self.norm = norm
+
         self.iter = iter
 
         self.f0_norm = None


Test patch:
diff --git a/scipy/optimize/tests/test_nonlin.py b/scipy/optimize/tests/test_nonlin.py
--- a/scipy/optimize/tests/test_nonlin.py
+++ b/scipy/optimize/tests/test_nonlin.py
@@ -124,6 +124,18 @@ def test_problem_nonlin(self):
                     continue
                 yield self._check_nonlin_func, f, func
 
+    def test_tol_norm_called(self):
+        # Check that supplying tol_norm keyword to nonlin_solve works
+        self._tol_norm_used = False
+
+        def local_norm_func(x):
+            self._tol_norm_used = True
+            return np.absolute(x).max()
+
+        nonlin.newton_krylov(F, F.xin, f_tol=1e-2, maxiter=200, verbose=0,
+             tol_norm=local_norm_func)
+        assert_(self._tol_norm_used)
+
     def test_problem_root(self):
         """ Tests for root """
         for f in [F, F2, F2_lucky, F3, F4_powell, F5, F6]:
Repository: scipy/scipy

Issue:
Documentation of scipy.signal.cwt error
There is probably an error in the documentation of scipy.signal.cwt:

It is:
Returns:  
cwt: (M, N) ndarray
Will have shape of (len(data), len(widths)).

It should be:
Returns:  
cwt: (M, N) ndarray
Will have shape of (len(widths), len(data)).



Discussion:
Looks correct, care to submit a PR with a fix?

Sorry but I am not familiar with this project nor with GitHub in general, can you do that for me?

Thanks


Resolving patch:
diff --git a/scipy/signal/wavelets.py b/scipy/signal/wavelets.py
--- a/scipy/signal/wavelets.py
+++ b/scipy/signal/wavelets.py
@@ -332,7 +332,7 @@ def cwt(data, wavelet, widths):
     Returns
     -------
     cwt: (M, N) ndarray
-        Will have shape of (len(data), len(widths)).
+        Will have shape of (len(widths), len(data)).
 
     Notes
     -----


Test patch:
Repository: scipy/scipy

Issue:
improve accuracy of scipy.stats.lomax distribution for small x.
Currently the cdf-ppf round trip for small x return wrong values as shown here:
    In [85]: lomax.ppf(lomax.cdf(1e-100,1),1)
    Out[85]: 0.0

By replacing(1+x) with exp(log1p(x),  exp(x)-1 with expm1(x) and log(1+x) with log1p(x) one can improve the accuracy of the lomax distribution (_logpdf, _cdf, _sf, _logsf and _ppf) to machine precision for small x.

Replacing _logpdf, _cdf, _sf, logsf and _ppf with

```
def _logpdf(self, x, c):
    return log(c) - (c + 1) * log1p(x)

def _cdf(self, x, c):
    return -expm1(-c*log1p(x))

def _sf(self, x, c):
    return exp(-c*log1p(x))

def _logsf(self, x, c):
    return -c * log1p(x)

def _ppf(self, q, c):
    return expm1(-log1p(-q)/c)
```

one acheives 
    In [86]: lomax.ppf(lomax.cdf(1e-100,1),1)
    Out[86]: 1e-100



Discussion:

Resolving patch:
diff --git a/scipy/stats/_continuous_distns.py b/scipy/stats/_continuous_distns.py
--- a/scipy/stats/_continuous_distns.py
+++ b/scipy/stats/_continuous_distns.py
@@ -3227,19 +3227,19 @@ def _pdf(self, x, c):
         return c*1.0/(1.0+x)**(c+1.0)
 
     def _logpdf(self, x, c):
-        return log(c) - (c+1)*log(1+x)
+        return log(c) - (c+1)*special.log1p(x)
 
     def _cdf(self, x, c):
-        return 1.0-1.0/(1.0+x)**c
+        return -special.expm1(-c*special.log1p(x))
 
     def _sf(self, x, c):
-        return 1.0/(1.0+x)**c
+        return exp(-c*special.log1p(x))
 
     def _logsf(self, x, c):
-        return -c*log(1+x)
+        return -c*special.log1p(x)
 
     def _ppf(self, q, c):
-        return pow(1.0-q, -1.0/c)-1
+        return special.expm1(-special.log1p(-q)/c)
 
     def _stats(self, c):
         mu, mu2, g1, g2 = pareto.stats(c, loc=-1.0, moments='mvsk')


Test patch:
diff --git a/scipy/stats/tests/test_distributions.py b/scipy/stats/tests/test_distributions.py
--- a/scipy/stats/tests/test_distributions.py
+++ b/scipy/stats/tests/test_distributions.py
@@ -2168,6 +2168,10 @@ def test_infinite_input():
     assert_almost_equal(stats.skellam.sf(np.inf, 10, 11), 0)
     assert_almost_equal(stats.ncx2._cdf(np.inf, 8, 0.1), 1)
 
+def test_lomax_accuracy():
+    # regression test for gh-4033
+    p = stats.lomax.ppf(stats.lomax.cdf(1e-100,1),1)
+    assert_equal(p, 1e-100)
 
 if __name__ == "__main__":
     run_module_suite()
Repository: scipy/scipy

Issue:
improve accuracy of scipy.stats.truncexpon distribution for small x
Currently the cdf-ppf round trip for small x return wrong values as shown here:
In [85]: truncexpon.ppf(truncexpon.cdf(1e-100,1),1)
Out[85]: 0.0

By replacing exp(x)-1 with expm1(x) and log(1+x) with log1p(x) one can improve the accuracy of the truncexpon distribution (_pdf, _logpdf, _cdf and _ppf) to machine precision for small x.

Replacing _pdf, _logpdf, _cdf and _ppf with

```
def _pdf(self, x, b):
    return exp(-x) / (-expm1(-b))

def _logpdf(self, x, b):
    return - x - log(-expm1(-b))

def _cdf(self, x, b):
    return expm1(-x) / expm1(-b)

def _ppf(self, q, b):
    return - log1p(q * expm1(-b))
```

one achieves 
In [92]: truncexpon.ppf(truncexpon.cdf(1e-100,1),1)
Out[92]: 1e-100



Discussion:
@rgommers I think even this is on the similar lines. In the PR #4050 , I think only the test case is updated, but not the implementation of `ppf`, `cdf` in `truncexpon`. I checked that PR, and it is inactive, but if I tried to pull it and use it, it is way behind master branch. Can I solve this also, just that it is Sunday today, I want to do something useful.

Sure, if you could complete that fix and send it as a new PR that would be helpful. 


Resolving patch:
diff --git a/scipy/stats/_continuous_distns.py b/scipy/stats/_continuous_distns.py
--- a/scipy/stats/_continuous_distns.py
+++ b/scipy/stats/_continuous_distns.py
@@ -3764,16 +3764,16 @@ def _argcheck(self, b):
         return (b > 0)
 
     def _pdf(self, x, b):
-        return exp(-x)/(1-exp(-b))
+        return exp(-x)/(-special.expm1(-b))
 
     def _logpdf(self, x, b):
-        return -x - log(1-exp(-b))
+        return -x - log(-special.expm1(-b))
 
     def _cdf(self, x, b):
-        return (1.0-exp(-x))/(1-exp(-b))
+        return special.expm1(-x)/special.expm1(-b)
 
     def _ppf(self, q, b):
-        return -log(1-q+q*exp(-b))
+        return -special.log1p(q*special.expm1(-b))
 
     def _munp(self, n, b):
         # wrong answer with formula, same as in continuous.pdf


Test patch:
diff --git a/scipy/stats/tests/test_distributions.py b/scipy/stats/tests/test_distributions.py
--- a/scipy/stats/tests/test_distributions.py
+++ b/scipy/stats/tests/test_distributions.py
@@ -2172,6 +2172,11 @@ def test_lomax_accuracy():
     # regression test for gh-4033
     p = stats.lomax.ppf(stats.lomax.cdf(1e-100,1),1)
     assert_equal(p, 1e-100)
+    
+def test_truncexpon_accuracy():
+    # regression test for gh-4035
+    p = stats.truncexpon.ppf(stats.truncexpon.cdf(1e-100,1),1)
+    assert_almost_equal(p, 1e-100, decimal=15)
 
 if __name__ == "__main__":
     run_module_suite()
Repository: scipy/scipy

Issue:
improve accuracy of scipy.stats.rayleigh distribution for large x
Currently the sf-isf round trip for large x return wrong values as shown here:
In [85]: rayleigh.isf(rayleigh.sf(9,1),1)
Out[85]: 9.0000752648062754

By replacing exp(x)-1 with expm1(x) and log(1+x) with log1p(x) one can improve the accuracy of the rayleigh distribution (_cdf, _sf, and _ppf) to machine precision for large x.

Replacing _cdf  and _ppf with

```
def _cdf(self, r):
    return - expm1(-r * r / 2.0)

def _sf(self, r):
    return exp(-r * r / 2.0)

def _isf(self, q):
    return sqrt(-2 * log(q))

def _ppf(self, q):
    return sqrt(-2 * log1p(-q))
```

one acheives 
In [86]: rayleigh.isf(rayleigh.sf(9,1),1)
Out[86]: 9.0



Discussion:
According to the notes for `expm1`

This function provides greater precision than `exp(x) - 1` for small values of `x`.

The notes for `log1p` make a similar statement. 

Otherwise, this seems like a good change to make, and looks simple enough. I can make the change for this distribution, and the others you created an issue for.


Resolving patch:
diff --git a/scipy/stats/_continuous_distns.py b/scipy/stats/_continuous_distns.py
--- a/scipy/stats/_continuous_distns.py
+++ b/scipy/stats/_continuous_distns.py
@@ -3542,10 +3542,16 @@ def _pdf(self, r):
         return r * exp(-0.5 * r**2)
 
     def _cdf(self, r):
-        return 1 - exp(-0.5 * r**2)
+        return -special.expm1(-0.5 * r**2)
 
     def _ppf(self, q):
-        return sqrt(-2 * log(1 - q))
+        return sqrt(-2 * special.log1p(-q))
+        
+    def _sf(self, r):
+        return exp(-0.5 * r**2)
+        
+    def _isf(self, q):
+        return sqrt(-2 * log(q))
 
     def _stats(self):
         val = 4 - pi


Test patch:
diff --git a/scipy/stats/tests/test_distributions.py b/scipy/stats/tests/test_distributions.py
--- a/scipy/stats/tests/test_distributions.py
+++ b/scipy/stats/tests/test_distributions.py
@@ -2171,12 +2171,17 @@ def test_infinite_input():
 def test_lomax_accuracy():
     # regression test for gh-4033
     p = stats.lomax.ppf(stats.lomax.cdf(1e-100,1),1)
-    assert_equal(p, 1e-100)
+    assert_allclose(p, 1e-100)
     
 def test_truncexpon_accuracy():
     # regression test for gh-4035
     p = stats.truncexpon.ppf(stats.truncexpon.cdf(1e-100,1),1)
-    assert_almost_equal(p, 1e-100, decimal=15)
+    assert_allclose(p, 1e-100)
+
+def test_rayleigh_accuracy():
+    # regression test for gh-4034
+    p = stats.rayleigh.isf(stats.rayleigh.sf(9,1),1)
+    assert_almost_equal(p, 9.0, decimal=15)
 
 if __name__ == "__main__":
     run_module_suite()
Repository: scipy/scipy

Issue:
Broken check in uses_mkl for newer versions of the library
Intel MKL has a new linking method, described here: https://software.intel.com/en-us/articles/a-new-linking-model-single-dynamic-library-mkl_rt-since-intel-mkl-103

In `scipy/_build_utils/_fortran.py`, in function `uses_mkl`, it says:

``` python
    r_mkl = re.compile("mkl_core")
```

and then searches in the libraries which won't hit when only linking mkl_rt.

Could you maybe change the expression to match "mkl"?



Discussion:

Resolving patch:
diff --git a/scipy/_build_utils/_fortran.py b/scipy/_build_utils/_fortran.py
--- a/scipy/_build_utils/_fortran.py
+++ b/scipy/_build_utils/_fortran.py
@@ -33,7 +33,7 @@ def uses_accelerate(info):
 
 
 def uses_mkl(info):
-    r_mkl = re.compile("mkl_core")
+    r_mkl = re.compile("mkl")
     libraries = info.get('libraries', '')
     for library in libraries:
         if r_mkl.search(library):
@@ -46,8 +46,7 @@ def needs_g77_abi_wrapper(info):
     """Returns True if g77 ABI wrapper must be used."""
     if uses_accelerate(info) or uses_veclib(info):
         return True
-    # XXX: is this really true only on Mac OS X ?
-    elif uses_mkl(info) and sys.platform == "darwin":
+    elif uses_mkl(info):
         return True
     else:
         return False


Test patch:
Repository: scipy/scipy

Issue:
DOC: optimize: _minimize_scalar_brent does not have a disp option
The docstring for [_minimize_scalar_brent](https://github.com/scipy/scipy/blob/master/scipy/optimize/optimize.py#L1907) claims to support a `disp` option, but when passed one it raises: `OptimizeWarning: Unknown solver options: disp`.

I'm not sure if there actually is a more verbose mode to toggle here, or if this is simply a documentation error.



Discussion:
It's a documentation issue.


Resolving patch:
diff --git a/scipy/optimize/optimize.py b/scipy/optimize/optimize.py
--- a/scipy/optimize/optimize.py
+++ b/scipy/optimize/optimize.py
@@ -1915,8 +1915,6 @@ def _minimize_scalar_brent(func, brack=None, args=(),
     -------
     maxiter : int
         Maximum number of iterations to perform.
-    disp : bool
-        Set to True to print convergence messages.
     xtol : float
         Relative error in solution `xopt` acceptable for convergence.
 
@@ -1990,8 +1988,6 @@ def _minimize_scalar_golden(func, brack=None, args=(),
     -------
     maxiter : int
         Maximum number of iterations to perform.
-    disp : bool
-        Set to True to print convergence messages.
     xtol : float
         Relative error in solution `xopt` acceptable for convergence.
 


Test patch:
Repository: scipy/scipy

Issue:
Passing array as window into signal.resample() fails
The docs say I can pass an `array` into the `window` keyword argument of `scipy.signal.resample`, however the following code fails

```
osfactor = 128
sig = numpy.arange(128)

win = scipy.signal.get_window(('kaiser', 8.0), osfactor // 2)
sig = scipy.signal.resample(sig, len(sig) * osfactor, window=win)
```

with the following message:

```
Traceback (most recent call last):
  File "test.py", line 8, in <module>
    sig = scipy.signal.resample(sig, len(sig) * osfactor, window=win)
  File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/signal/signaltools.py", line 1325, in resample
    W = ifftshift(get_window(window, Nx))
  File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/signal/windows.py", line 1389, in get_window
    if winstr in ['blackman', 'black', 'blk']:
UnboundLocalError: local variable 'winstr' referenced before assignment
```

Using

```
numpy.__version__ = 1.8.1
scipy.__version__ = 0.13.3
```



Discussion:
When you use an array as the window, it must be the same length as the signal.  From the _Notes_ section of the `resample` docstring:

```
If `window` is an array of the same length as `x.shape[axis]` it is
assumed to be the window to be applied directly in the Fourier
domain (with dc and low-frequency first).
```

---

Your example _does_ demonstrate a bug in scipy.  That bug is relatively minor and not the cause of the problem you have, but it is the cause of the somewhat cryptic error message.    The bug is in `scipy.signal.get_window`.   When the argument to `get_window` is an array, the code ends up referring to an undefined variable `winstr`.


Resolving patch:
diff --git a/scipy/signal/signaltools.py b/scipy/signal/signaltools.py
--- a/scipy/signal/signaltools.py
+++ b/scipy/signal/signaltools.py
@@ -1567,7 +1567,9 @@ def resample(x, num, t=None, axis=0, window=None):
     if window is not None:
         if callable(window):
             W = window(fftfreq(Nx))
-        elif isinstance(window, ndarray) and window.shape == (Nx,):
+        elif isinstance(window, ndarray):
+            if window.shape != (Nx,):
+                raise ValueError('window must have the same length as data')
             W = window
         else:
             W = ifftshift(get_window(window, Nx))


Test patch:
diff --git a/scipy/signal/tests/test_signaltools.py b/scipy/signal/tests/test_signaltools.py
--- a/scipy/signal/tests/test_signaltools.py
+++ b/scipy/signal/tests/test_signaltools.py
@@ -460,6 +460,17 @@ def test_basic(self):
         assert_array_almost_equal(signal.wiener(g, mysize=3), h, decimal=6)
 
 
+class TestResample(TestCase):
+
+    def test_basic(self):
+        # Regression test for issue #3603.
+        # window.shape must equal to sig.shape[0]
+        sig = np.arange(128)
+        num = 256
+        win = signal.get_window(('kaiser', 8.0), 160)
+        assert_raises(ValueError, signal.resample, sig, num, window=win)
+
+
 class TestCSpline1DEval(TestCase):
 
     def test_basic(self):
Repository: scipy/scipy

Issue:
syntax error in the `ode` docstring example
Copy-pasting the example from 
https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.ode.html#scipy.integrate.ode
chokes on the string formatting of a complex-valued ndarray: 

```
>>> r = ode(f, jac).set_integrator('zvode', method='bdf')
>>> r.set_initial_value(y0, t0).set_f_params(2.0).set_jac_params(2.0)
<scipy.integrate._ode.ode object at 0x7f56978db190>
>>> while r.successful() and r.t < t1:
...    r.integrate(r.t+dt)
...    print("%g %g" % (r.t, r.y))
... 
array([-0.71038232+0.23749653j,  0.40000271+0.j        ])
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
TypeError: float argument required, not numpy.ndarray
```



Discussion:

Resolving patch:
diff --git a/scipy/integrate/_ode.py b/scipy/integrate/_ode.py
--- a/scipy/integrate/_ode.py
+++ b/scipy/integrate/_ode.py
@@ -319,8 +319,7 @@ class ode(object):
     >>> t1 = 10
     >>> dt = 1
     >>> while r.successful() and r.t < t1:
-    ...     r.integrate(r.t+dt)
-    ...     print("%g %g" % (r.t, r.y))
+    ...     print(r.t, r.integrate(r.t+dt))
 
     References
     ----------


Test patch:
Repository: scipy/scipy

Issue:
Fixed docs in spearmanr
Fixed the description of axis argument.



Discussion:

Resolving patch:
diff --git a/scipy/stats/stats.py b/scipy/stats/stats.py
--- a/scipy/stats/stats.py
+++ b/scipy/stats/stats.py
@@ -2891,13 +2891,13 @@ def spearmanr(a, b=None, axis=0):
     ----------
     a, b : 1D or 2D array_like, b is optional
         One or two 1-D or 2-D arrays containing multiple variables and
-        observations. Each column of `a` and `b` represents a variable, and
-        each row entry a single observation of those variables. See also
-        `axis`. Both arrays need to have the same length in the `axis`
-        dimension.
+        observations. When these are 1-D, each represents a vector of
+        observations of a single variable. For the behavior in the 2-D case,
+        see under ``axis``, below.
+        Both arrays need to have the same length in the ``axis`` dimension.
     axis : int or None, optional
         If axis=0 (default), then each column represents a variable, with
-        observations in the rows. If axis=0, the relationship is transposed:
+        observations in the rows. If axis=1, the relationship is transposed:
         each row represents a variable, while the columns contain observations.
         If axis=None, then both arrays will be raveled.
 


Test patch: