title: Unexpected behavior of Gaussian filtering with Scipy
body: <p>Given that I have an image <code>f(x,y)</code> loaded, for example,</p>
  
  <p><a href="https://i.stack.imgur.com/RJZzW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/RJZzW.png" alt="enter image description here"></a></p>
  
  <p>I want to compute the Gaussian derivative <code>∂/∂x ∂/∂y G*f</code> of the image <code>f</code>, where <code>G</code> is a Gaussian filter and <code>*</code> denotes convolution. This is easily done using Scipy:</p>
  
  <pre class="lang-py prettyprint-override"><code>from scipy.ndimage.filters import gaussian_filter
  imshow(gaussian_filter(g, sigma, order=1))
  </code></pre>
  
  <p>With <code>sigma=50</code> this produces the following result:</p>
  
  <p><a href="https://i.stack.imgur.com/hVg64.png" rel="noreferrer"><img src="https://i.stack.imgur.com/hVg64.png" alt="enter image description here"></a></p>
  
  <p>Now, for applicationary reasons, I need to do the computation with <code>mode='constant'</code>:</p>
  
  <pre class="lang-py prettyprint-override"><code>imshow(gaussian_filter(g, sigma, order=1, mode='constant', cval=0))
  </code></pre>
  
  <p>Still, the result looks reasonable:</p>
  
  <p><a href="https://i.stack.imgur.com/971I5.png" rel="noreferrer"><img src="https://i.stack.imgur.com/971I5.png" alt="enter image description here"></a></p>
  
  <p>However, note that my image's background's intensity is <code>1</code> and not <code>0</code>. Hence, it should be reasonable to use <code>cval=1</code>:</p>
  
  <pre class="lang-py prettyprint-override"><code>imshow(gaussian_filter(g, sigma, order=1, mode='constant', cval=1))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/VQRpf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VQRpf.png" alt="enter image description here"></a></p>
  
  <p>Now this is unexpected! This result makes no sense, does it?</p>
  
  <p>For the record, I also checked the partial differentials <code>∂/∂x G*f</code> and <code>∂/∂y G*f</code>. Whereas</p>
  
  <pre class="lang-py prettyprint-override"><code>imshow(gaussian_filter(g, sigma, order=[0, 1], mode='constant', cval=1)
  </code></pre>
  
  <p>looks reasonable</p>
  
  <p><a href="https://i.stack.imgur.com/rRKPZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rRKPZ.png" alt="enter image description here"></a></p>
  
  <p>the other one</p>
  
  <pre class="lang-py prettyprint-override"><code>imshow(gaussian_filter(g, sigma, order=[1, 0], mode='constant', cval=1)
  </code></pre>
  
  <p>does not:</p>
  
  <p><a href="https://i.stack.imgur.com/SoOIO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/SoOIO.png" alt="enter image description here"></a></p>
  
  <p>Why is that?</p>