'Determine a suitable frequency grid for data.
Note that this assumes the peak width is driven by the observational
baseline, which is generally a good assumption when the baseline is
much larger than the oscillation period.
If you are searching for periods longer than the baseline of your
observations, this may not perform well.
Even with a large baseline, be aware that the maximum frequency
returned is based on the concept of "average Nyquist frequency", which
may not be useful for irregularly-sampled data. The maximum frequency
can be adjusted via the nyquist_factor argument, or through the
maximum_frequency argument.
Parameters
samples_per_peak : float (optional, default=5)
The approximate number of desired samples across the typical peak
nyquist_factor : float (optional, default=5)
The multiple of the average nyquist frequency used to choose the
maximum frequency if maximum_frequency is not provided.
minimum_frequency : float (optional)
If specified, then use this minimum frequency rather than one
chosen based on the size of the baseline.
maximum_frequency : float (optional)
If specified, then use this maximum frequency rather than one
chosen based on the average nyquist frequency.
Returns
frequency : ndarray or Quantity
The heuristically-determined optimal frequency bin'

def autofrequency(self, samples_per_peak=5, nyquist_factor=5, minimum_frequency=None, maximum_frequency=None):

    baseline = (self.t.max() - self.t.min())
    n_samples = self.t.size
    df = ((1.0 / baseline) / samples_per_peak)
    if (minimum_frequency is None):
        minimum_frequency = (0.5 * df)
    if (maximum_frequency is None):
        avg_nyquist = ((0.5 * n_samples) / baseline)
        maximum_frequency = (nyquist_factor * avg_nyquist)
    Nf = (1 + int(np.round(((maximum_frequency - minimum_frequency) / df))))
    return (minimum_frequency + (df * np.arange(Nf)))
