code: def median_frequency(sig,FS):
      
      
      f, fs = plotfft(sig, FS, doplot=False)    
      t = cumsum(fs)
      
      ind_mag = find (t>t[-1]*0.50)[0]
      f_median=f[ind_mag]
      return f_median
docs: Compute median frequency along the specified axes.
  
      Parameters
      ----------
      sig: ndarray
          input from which median frequency is computed.
      FS: int
          sampling frequency    
      Returns
      -------
      f_max: int
         0.50 of max_frequency using cumsum.