title: Find local minima and maxima simultanously with scipy.signal.argrelextrema
body: <p>I would like to find the local minima and maxima simultanously in an array. I attempted to use Scipy's argrelextrema, but I don't find any documentation on the required comparator function. I attempted to write my own with no success. How could I do this?</p>
  
  <p>I'd like to do this, but only calling <code>argrelextrema</code> once instead of iterating over the data twice with <code>argrelmin</code> and <code>argrelmax</code>, as my data is pretty long, and I have to do this multiple times with it:</p>
  
  <pre><code>   import numpy as np
     import scipy.signal as sg
  
     data = [[xes], [ys]]   #a long 2d array
     max_places = np.array(sg.argrelmax(data[1]))[0] 
     min_places = np.array(sg.argrelmin(data[1]))[0]
     extrema_places = np.contantenate((max_places, min_places))
  </code></pre>