def macf_period_find(<EOL>times,<EOL>mags,<EOL>errs,<EOL>fillgaps=<NUM_LIT:0.0>,<EOL>filterwindow=<NUM_LIT:11>,<EOL>forcetimebin=None,<EOL>maxlags=None,<EOL>maxacfpeaks=<NUM_LIT:10>,<EOL>smoothacf=<NUM_LIT>,  <EOL>smoothfunc=_smooth_acf_savgol,<EOL>smoothfunckwargs=None,<EOL>magsarefluxes=False,<EOL>sigclip=<NUM_LIT>,<EOL>verbose=True,<EOL>periodepsilon=<NUM_LIT:0.1>,  <EOL>nworkers=None,      <EOL>startp=None,        <EOL>endp=None,          <EOL>autofreq=None,      <EOL>stepsize=None,      <EOL>):
<EOL>acfres = autocorr_magseries(<EOL>times,<EOL>mags,<EOL>errs,<EOL>maxlags=maxlags,<EOL>fillgaps=fillgaps,<EOL>forcetimebin=forcetimebin,<EOL>sigclip=sigclip,<EOL>magsarefluxes=magsarefluxes,<EOL>filterwindow=filterwindow,<EOL>verbose=verbose<EOL>)<EOL>xlags = acfres['<STR_LIT>']<EOL>if smoothacf and isinstance(smoothacf, int) and smoothacf > <NUM_LIT:0>:<EOL><INDENT>if smoothfunckwargs is None:<EOL><INDENT>sfkwargs = {'<STR_LIT>':smoothacf}<EOL><DEDENT>else:<EOL><INDENT>sfkwargs = smoothfunckwargs.copy()<EOL>sfkwargs.update({'<STR_LIT>':smoothacf})<EOL><DEDENT>xacf = smoothfunc(acfres['<STR_LIT>'], **sfkwargs)<EOL><DEDENT>else:<EOL><INDENT>xacf = acfres['<STR_LIT>']<EOL><DEDENT>peakres = _get_acf_peakheights(xlags, xacf, npeaks=maxacfpeaks,<EOL>searchinterval=int(smoothacf/<NUM_LIT:2>))<EOL>bestlspval = peakres['<STR_LIT>']<EOL>try:<EOL><INDENT>fity = npconcatenate((<EOL>[<NUM_LIT:0.0>, peakres['<STR_LIT>']],<EOL>peakres['<STR_LIT>'][peakres['<STR_LIT>'] > peakres['<STR_LIT>']]<EOL>))<EOL>fity = fity*acfres['<STR_LIT>']<EOL>fitx = nparange(fity.size)<EOL>fitcoeffs, fitcovar = nppolyfit(fitx, fity, <NUM_LIT:1>, cov=True)<EOL>fitbestperiod = fitcoeffs[<NUM_LIT:0>]<EOL>bestperiodrms = npsqrt(fitcovar[<NUM_LIT:0>,<NUM_LIT:0>])  <EOL><DEDENT>except Exception as e:<EOL><INDENT>LOGWARNING('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL>fitcoeffs = nparray([npnan, npnan])<EOL>fitcovar = nparray([[npnan, npnan], [npnan, npnan]])<EOL>fitbestperiod = npnan<EOL>bestperiodrms = npnan<EOL>raise<EOL><DEDENT>naivebestperiod = peakres['<STR_LIT>']*acfres['<STR_LIT>']<EOL>if fitbestperiod < naivebestperiod:<EOL><INDENT>LOGWARNING('<STR_LIT>'<EOL>'<STR_LIT>' %<EOL>(fitbestperiod, naivebestperiod))<EOL><DEDENT>if npisfinite(fitbestperiod):<EOL><INDENT>bestperiod = fitbestperiod<EOL><DEDENT>else:<EOL><INDENT>bestperiod = naivebestperiod<EOL><DEDENT>return {'<STR_LIT>':bestperiod,<EOL>'<STR_LIT>':bestlspval,<EOL>'<STR_LIT>':maxacfpeaks,<EOL>'<STR_LIT>':npconcatenate([<EOL>[fitbestperiod],<EOL>peakres['<STR_LIT>'][<NUM_LIT:1>:maxacfpeaks]*acfres['<STR_LIT>']<EOL>]),<EOL>'<STR_LIT>':peakres['<STR_LIT>'][:maxacfpeaks],<EOL>'<STR_LIT>':xacf,<EOL>'<STR_LIT>':xlags*acfres['<STR_LIT>'],<EOL>'<STR_LIT>':xacf,<EOL>'<STR_LIT>':xlags,<EOL>'<STR_LIT>':'<STR_LIT>',<EOL>'<STR_LIT>':naivebestperiod,<EOL>'<STR_LIT>':fitbestperiod,<EOL>'<STR_LIT>':bestperiodrms,<EOL>'<STR_LIT>':fitcoeffs,<EOL>'<STR_LIT>':fitcovar,<EOL>'<STR_LIT>':{'<STR_LIT>':maxlags,<EOL>'<STR_LIT>':maxacfpeaks,<EOL>'<STR_LIT>':fillgaps,<EOL>'<STR_LIT>':filterwindow,<EOL>'<STR_LIT>':smoothacf,<EOL>'<STR_LIT>':sfkwargs,<EOL>'<STR_LIT>':magsarefluxes,<EOL>'<STR_LIT>':sigclip},<EOL>'<STR_LIT>':acfres,<EOL>'<STR_LIT>':peakres}<EOL>
This finds periods using the McQuillan+ (2013a, 2014) ACF method.

    The kwargs from `periodepsilon` to `stepsize` don't do anything but are used
    to present a consistent API for all periodbase period-finders to an outside
    driver (e.g. the one in the checkplotserver).

    Parameters
    ----------

    times,mags,errs : np.array
        The input magnitude/flux time-series to run the period-finding for.

    fillgaps : 'noiselevel' or float
        This sets what to use to fill in gaps in the time series. If this is
        'noiselevel', will smooth the light curve using a point window size of
        `filterwindow` (this should be an odd integer), subtract the smoothed LC
        from the actual LC and estimate the RMS. This RMS will be used to fill
        in the gaps. Other useful values here are 0.0, and npnan.

    filterwindow : int
        The light curve's smoothing filter window size to use if
        `fillgaps='noiselevel`'.

    forcetimebin : None or float
        This is used to force a particular cadence in the light curve other than
        the automatically determined cadence. This effectively rebins the light
        curve to this cadence. This should be in the same time units as `times`.

    maxlags : None or int
        This is the maximum number of lags to calculate. If None, will calculate
        all lags.

    maxacfpeaks : int
        This is the maximum number of ACF peaks to use when finding the highest
        peak and obtaining a fit period.

    smoothacf : int
        This is the number of points to use as the window size when smoothing
        the ACF with the `smoothfunc`. This should be an odd integer value. If
        this is None, will not smooth the ACF, but this will probably lead to
        finding spurious peaks in a generally noisy ACF.

        For Kepler, a value between 21 and 51 seems to work fine. For ground
        based data, much larger values may be necessary: between 1001 and 2001
        seem to work best for the HAT surveys. This is dependent on cadence, RMS
        of the light curve, the periods of the objects you're looking for, and
        finally, any correlated noise in the light curve. Make a plot of the
        smoothed/unsmoothed ACF vs. lag using the result dict of this function
        and the `plot_acf_results` function above to see the identified ACF
        peaks and what kind of smoothing might be needed.

        The value of `smoothacf` will also be used to figure out the interval to
        use when searching for local peaks in the ACF: this interval is 1/2 of
        the `smoothacf` value.

    smoothfunc : Python function
        This is the function that will be used to smooth the ACF. This should
        take at least one kwarg: 'windowsize'. Other kwargs can be passed in
        using a dict provided in `smoothfunckwargs`. By default, this uses a
        Savitsky-Golay filter, a Gaussian filter is also provided but not
        used. Another good option would be an actual low-pass filter (generated
        using scipy.signal?) to remove all high frequency noise from the ACF.

    smoothfunckwargs : dict or None
        The dict of optional kwargs to pass in to the `smoothfunc`.

    magsarefluxes : bool
        If your input measurements in `mags` are actually fluxes instead of
        mags, set this is True.

    sigclip : float or int or sequence of two floats/ints or None
        If a single float or int, a symmetric sigma-clip will be performed using
        the number provided as the sigma-multiplier to cut out from the input
        time-series.

        If a list of two ints/floats is provided, the function will perform an
        'asymmetric' sigma-clip. The first element in this list is the sigma
        value to use for fainter flux/mag values; the second element in this
        list is the sigma value to use for brighter flux/mag values. For
        example, `sigclip=[10., 3.]`, will sigclip out greater than 10-sigma
        dimmings and greater than 3-sigma brightenings. Here the meaning of
        "dimming" and "brightening" is set by *physics* (not the magnitude
        system), which is why the `magsarefluxes` kwarg must be correctly set.

        If `sigclip` is None, no sigma-clipping will be performed, and the
        time-series (with non-finite elems removed) will be passed through to
        the output.

    verbose : bool
        If True, will indicate progress and report errors.

    Returns
    -------

    dict
        Returns a dict with results. dict['bestperiod'] is the estimated best
        period and dict['fitperiodrms'] is its estimated error. Other
        interesting things in the output include:

        - dict['acfresults']: all results from calculating the ACF. in
          particular, the unsmoothed ACF might be of interest:
          dict['acfresults']['acf'] and dict['acfresults']['lags'].

        - dict['lags'] and dict['acf'] contain the ACF after smoothing was
          applied.

        - dict['periods'] and dict['lspvals'] can be used to construct a
          pseudo-periodogram.

        - dict['naivebestperiod'] is obtained by multiplying the lag at the
          highest ACF peak with the cadence. This is usually close to the fit
          period (dict['fitbestperiod']), which is calculated by doing a fit to
          the lags vs. peak index relation as in McQuillan+ 2014.