function fps = find_rel_peaks_raw(XP,big,fmin,rth,fsmp)
  # Given a power spectrum {XP} of a signal,
  # and a vector of boolean indicators {big} for its elements,
  # 
  # Returns one row in {fps} for every 
  # run of almost-consecutive such elements,
  # assume to be a "peak" -- a strong nearly pure sinusoidal 
  # noise signal.
  # 
  # Each row of {fps} has three elements {f,fsigma,pwr}
  # where {f} is the estimated central frequency
  # of the peak, {fsigma} is its estimated standard
  # deviation, and {pwr} is the estimated total power.  
  
  assert(size(XP,2)==1)
  assert(size(big,2)==1)
  assert(size(XP,1)==size(big,1))
  NP = size(XP,1); # Number of entries in power spectrum.
  N = 2*(NP-1); # Assumed number of samples in signal.
  
  # Merge runs of big elements that are too close:
  ct = 0; # Number of small elements since last big one.
  for ii = 1:NP
    if big(ii,1)
      if (ct > 0) && (ct < 4)
        # Mark the previous {ct} elements as big too:
        for kk = 1:ct
          big(ii-kk,1) = true;
        end
      end
      ct = 0;
    else
      ct = ct + 1;
    end
  end
  # Find runs of big elements. 
  # Assume that array is mirrored at ends.
  df_ini = -1; # First recent digital freq above threshold.
  df_fin = -1; # Last recent digital freq above threshold.
  nf = 0; # Number of peaks already found.
  vmax = NaN;
  for ii = 1:NP+1
    if (ii <= NP) && big(ii,1)
      if df_ini < 0
        # Save first digital freq above threshold.
        df_ini = ii - 1
      end
      df_fin = ii - 1;
    elseif df_ini >= 0
      # End of a run.
      # Find max power in interval:
      vmax = 0;
      for dfj = df_ini:df_fin
        if XP(dfj+1,1) > vmax
          vmax = XP(dfj+1,1);
        end
      end
      # Estimate mean freq and width:
      if df_ini == 0
        # Peak around freq 0.
        df_mid = 0;
        df_sig = df_fin - df_ini + 1;
      elseif df_fin == NP-1
        # Peak around max freq.
        df_mid = NP-1;
        df_sig = df_fin - df_ini + 1;
      else
        df_mid = (df_ini + df_fin)/2;
        df_sig = (df_fin - df_ini)/2 + 1
      end
      # Save peak:
      nf = nf + 1;
      f_mid = fsmp*df_mid/N # Est mean value.
      f_sig = 3*fsmp*df_sig/N; # Est std dev (hack).
      pwr = vmax; # Est total power (hack).
      fps(nf,1) = fm;
      fps(nf,2) = fs; 
      fps(nf,3) = pwr; 
      # Prepare for next peak:
      df_ini = -1;
      df_fin = -1;
    end
  end
  fps = fps(1:nf,1:3);