docs: def finetune_best_frequencies(self, fresolution=1e-5, n_local_optima=10):
          """
          Computes the selected criterion over a grid of frequencies 
          around a specified amount of  local optima of the periodograms. This
          function is intended for additional fine tuning of the results obtained
          with grid_search
          """
          # Find the local optima
          local_optima_index = []
          for k in range(1, len(self.per)-1):
              if self.per[k-1] < self.per[k] and self.per[k+1] < self.per[k]:
                  local_optima_index.append(k)
          local_optima_index = np.array(local_optima_index)
          if(len(local_optima_index) < n_local_optima):
              print("Warning: Not enough local maxima found in the periodogram, skipping finetuning")
              return
          # Keep only n_local_optima
          best_local_optima = local_optima_index[np.argsort(self.per[local_optima_index])][::-1]
          if n_local_optima > 0:
              best_local_optima = best_local_optima[:n_local_optima]
          else:
              best_local_optima = best_local_optima[0]
          # Do finetuning around each local optima
          for j in range(n_local_optima):
              freq_fine = self.freq[best_local_optima[j]] - self.fres_grid
              for k in range(0, int(2.0*self.fres_grid/fresolution)):
                  cost = self.compute_metric(freq_fine)
                  if cost > self.per[best_local_optima[j]]:
                      self.per[best_local_optima[j]] = cost
                      self.freq[best_local_optima[j]] = freq_fine
                  freq_fine += fresolution
          # Sort them in descending order
          idx = np.argsort(self.per[best_local_optima])[::-1]
          if n_local_optima > 0:
              self.best_local_optima = best_local_optima[idx]
          else:
              self.best_local_optima = best_local_optima