Example #1
0
def get_multiharmonic_periodogram(x, y, err, nh, hfac=3, ofac=10):
    model = LombScargle(Nterms=nh)
    model.fit(x, y, err)

    pers, p = model.periodogram_auto(nyquist_factor=hfac, oversampling=ofac)

    return np.power(pers, -1), p
Example #2
0

for i in range(2):
    fig, ax = plt.subplots(2, 2, figsize=(10, 4), sharex='col')
    fig.subplots_adjust(left=0.07, right=0.95, wspace=0.1, bottom=0.15)

    if i == 0:
        ind = np.arange(Nobs) % 5
        y = mags[ind, np.arange(Nobs)]
        f = np.array(filts)[ind]
    else:
        arrs = np.broadcast_arrays(t, mags, dy, filts[:, None])
        t, y, dy, f = map(np.ravel, arrs)

    model1 = LombScargle()
    model1.fit(t, y, dy)
    yfit = model1.predict(tfit, period=period)

    plot_data(ax[0, 0], t, y, dy, f)
    ax[0, 0].plot(tfit / period, yfit, '-', color='gray', lw=4, alpha=0.5)
    ax[0, 1].plot(periods, model1.score(periods), color='gray')
    ax[0, 0].set_xlabel('')

    model2 = LombScargleMultiband(Nterms_base=1, Nterms_band=1)
    model2.fit(t, y, dy, f)
    yfits = model2.predict(tfit, filts=filts[:, None], period=period)

    plot_data(ax[1, 0], t, y, dy, f)
    for j in range(5):
        ax[1, 0].plot(tfit / period, yfits[j])
    ax[1, 1].plot(periods, model2.score(periods))