Repository: scipy/scipy

Issue:
scipy.signal.butter: "Must specify a single critical frequency Wn"
<!-- 
Thank you for taking the time to file a bug report. 
Please fill in the fields below, deleting the sections that 
don't apply to your issue. You can view the final output
by clicking the preview button above.
Note: This is a comment, and won't appear in the output.
-->

According to the [documentation](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.butter.html) for scipy.signal.butter:

_Wn : array_like_
        A scalar or **length-2 sequence** giving the critical frequencies.
        (...)

However, only a **single critical frequency** is accepted. Passing `Wn` as an array, list or tuple containing two critical frequencies produces `ValueError: Must specify a single critical frequency Wn`.

#### Reproducing code example:
<!-- 
If you place your code between the triple backticks below, 
it will be rendered as a code block. 
-->

```
"""
Tests butter by passing N=2, Wn=[0.1, 0.9] to the function.
Raises ValueError.
"""
from scipy.signal import butter
b, a = butter(2, [0.1, 0.9])
```
Matlab is able to produce a result from the equivalent code, `[b, a] = butter(2, [0.1, 0.9])`.

#### Error message:
<!-- If any, paste the *full* error message inside a code block
as above (starting from line Traceback)
-->

The `ValueError` is raised from precisely [this line](https://github.com/scipy/scipy/blob/b1bcb1226cc120f707fba3d0fa377120a60cff8d/scipy/signal/filter_design.py#L2353).
```
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "<...>/venv/lib/python3.6/site-packages/scipy/signal/filter_design.py", line 2858, in butter
    output=output, ftype='butter', fs=fs)
  File "<...>/venv/lib/python3.6/site-packages/scipy/signal/filter_design.py", line 2351, in iirfilter
    raise ValueError('Must specify a single critical frequency Wn')
ValueError: Must specify a single critical frequency Wn
```

#### Scipy/Numpy/Python version information:
<!-- You can simply run the following and paste the result in a code block
```
import sys, scipy, numpy; print(scipy.__version__, numpy.__version__, sys.version_info)
# Printed result
1.3.1 1.16.4 sys.version_info(major=3, minor=6, micro=8, releaselevel='final', serial=0)
```
-->
`1.3.1 1.16.4 sys.version_info(major=3, minor=6, micro=8, releaselevel='final', serial=0)`


Discussion:
I think this is probably a documentation bug, because whether it takes a single value or two values depends on the filter type (lowpass/highpass vs bandstop/bandpass).

@TheGreatCabbage can you (check that my understanding is correct and if so) make a PR to clarify the docs?

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
@@ -2350,7 +2350,7 @@ def iirfilter(N, Wn, rp=None, rs=None, btype='band', analog=False,
     # transform to lowpass, bandpass, highpass, or bandstop
     if btype in ('lowpass', 'highpass'):
         if numpy.size(Wn) != 1:
-            raise ValueError('Must specify a single critical frequency Wn')
+            raise ValueError('Must specify a single critical frequency Wn for lowpass or highpass filter')
 
         if btype == 'lowpass':
             z, p, k = lp2lp_zpk(z, p, k, wo=warped)
@@ -2361,7 +2361,7 @@ def iirfilter(N, Wn, rp=None, rs=None, btype='band', analog=False,
             bw = warped[1] - warped[0]
             wo = sqrt(warped[0] * warped[1])
         except IndexError:
-            raise ValueError('Wn must specify start and stop frequencies')
+            raise ValueError('Wn must specify start and stop frequencies for bandpass or bandstop filter')
 
         if btype == 'bandpass':
             z, p, k = lp2bp_zpk(z, p, k, wo=wo, bw=bw)
@@ -2768,7 +2768,10 @@ def butter(N, Wn, btype='low', analog=False, output='ba', fs=None):
     N : int
         The order of the filter.
     Wn : array_like
-        A scalar or length-2 sequence giving the critical frequencies.
+        The critical frequency or frequencies. For lowpass and highpass
+        filters, Wn is a scalar; for bandpass and bandstop filters,
+        Wn is a length-2 sequence.
+
         For a Butterworth filter, this is the point at which the gain
         drops to 1/sqrt(2) that of the passband (the "-3 dB point").
 


Test patch: