<p dir="auto">With Wn=2 I correctly got the message</p>
<p dir="auto"><code class="notranslate">ValueError: Digital filter critical frequencies must be 0 &lt; Wn &lt; 1</code></p>
<p dir="auto">But actually Wm=1 is accepted without error.  The message should be changed to  <code class="notranslate">0 &lt; Wn &lt;= 1</code> if 1 is allowed.</p>
<p dir="auto">When using <code class="notranslate">scipy.singal.iirfilter</code> (or any other related filter design method), it is possible to trigger the error <code class="notranslate">Digital filter critical frequencies must be 0 &lt; Wn &lt; 1</code>:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from scipy.signal import iirfilter
iirfilter(2, Wn=5, btype='low')"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">scipy</span>.<span class="pl-s1">signal</span> <span class="pl-k">import</span> <span class="pl-s1">iirfilter</span>
<span class="pl-en">iirfilter</span>(<span class="pl-c1">2</span>, <span class="pl-v">Wn</span><span class="pl-c1">=</span><span class="pl-c1">5</span>, <span class="pl-s1">btype</span><span class="pl-c1">=</span><span class="pl-s">'low'</span>)</pre></div>
<p dir="auto">This error message is correct and helpful in the default case, but when the newish <code class="notranslate">fs</code> parameter is used, the error message is misleading/wrong:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from scipy.signal import iirfilter
iirfilter(2, Wn=600, fs=1000, btype='low')   # Error message
iirfilter(2, Wn=300, fs=1000, btype='low')   # No Error message"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">scipy</span>.<span class="pl-s1">signal</span> <span class="pl-k">import</span> <span class="pl-s1">iirfilter</span>
<span class="pl-en">iirfilter</span>(<span class="pl-c1">2</span>, <span class="pl-v">Wn</span><span class="pl-c1">=</span><span class="pl-c1">600</span>, <span class="pl-s1">fs</span><span class="pl-c1">=</span><span class="pl-c1">1000</span>, <span class="pl-s1">btype</span><span class="pl-c1">=</span><span class="pl-s">'low'</span>)   <span class="pl-c"># Error message</span>
<span class="pl-en">iirfilter</span>(<span class="pl-c1">2</span>, <span class="pl-v">Wn</span><span class="pl-c1">=</span><span class="pl-c1">300</span>, <span class="pl-s1">fs</span><span class="pl-c1">=</span><span class="pl-c1">1000</span>, <span class="pl-s1">btype</span><span class="pl-c1">=</span><span class="pl-s">'low'</span>)   <span class="pl-c"># No Error message</span></pre></div>
<p dir="auto">This error message is generated in <a href="https://github.com/scipy/scipy/blob/b3a2071ce3952748c5e98ef7328d2b8eab77b2dc/scipy/signal/filter_design.py#L2346">this line</a>:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="if not analog:
    if numpy.any(Wn &lt;= 0) or numpy.any(Wn &gt;= 1):
        raise ValueError(&quot;Digital filter critical frequencies &quot;
                                   &quot;must be 0 &lt; Wn &lt; 1&quot;)"><pre class="notranslate"><span class="pl-k">if</span> <span class="pl-c1">not</span> <span class="pl-s1">analog</span>:
    <span class="pl-k">if</span> <span class="pl-s1">numpy</span>.<span class="pl-en">any</span>(<span class="pl-v">Wn</span> <span class="pl-c1">&lt;=</span> <span class="pl-c1">0</span>) <span class="pl-c1">or</span> <span class="pl-s1">numpy</span>.<span class="pl-en">any</span>(<span class="pl-v">Wn</span> <span class="pl-c1">&gt;=</span> <span class="pl-c1">1</span>):
        <span class="pl-k">raise</span> <span class="pl-v">ValueError</span>(<span class="pl-s">"Digital filter critical frequencies "</span>
                                   <span class="pl-s">"must be 0 &lt; Wn &lt; 1"</span>)</pre></div>
<p dir="auto">I would suggest to change it to:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="if not analog:
    if numpy.any(Wn &lt;= 0) or numpy.any(Wn &gt;= 1):
        if fs is not None:
            raise ValueError(&quot;Digital filter critical frequencies &quot;
                                       &quot;must be 0 &lt; Wn &lt; fs/2 (fs={})&quot;.format(fs))
        raise ValueError(&quot;Digital filter critical frequencies &quot;
                           &quot;must be 0 &lt; Wn &lt; 1&quot;)"><pre class="notranslate"><span class="pl-k">if</span> <span class="pl-c1">not</span> <span class="pl-s1">analog</span>:
    <span class="pl-k">if</span> <span class="pl-s1">numpy</span>.<span class="pl-en">any</span>(<span class="pl-v">Wn</span> <span class="pl-c1">&lt;=</span> <span class="pl-c1">0</span>) <span class="pl-c1">or</span> <span class="pl-s1">numpy</span>.<span class="pl-en">any</span>(<span class="pl-v">Wn</span> <span class="pl-c1">&gt;=</span> <span class="pl-c1">1</span>):
        <span class="pl-k">if</span> <span class="pl-s1">fs</span> <span class="pl-c1">is</span> <span class="pl-c1">not</span> <span class="pl-c1">None</span>:
            <span class="pl-k">raise</span> <span class="pl-v">ValueError</span>(<span class="pl-s">"Digital filter critical frequencies "</span>
                                       <span class="pl-s">"must be 0 &lt; Wn &lt; fs/2 (fs={})"</span>.<span class="pl-en">format</span>(<span class="pl-s1">fs</span>))
        <span class="pl-k">raise</span> <span class="pl-v">ValueError</span>(<span class="pl-s">"Digital filter critical frequencies "</span>
                           <span class="pl-s">"must be 0 &lt; Wn &lt; 1"</span>)</pre></div>
<p dir="auto">If this is ok, I would start a pull request with this change</p>