Exemplo n.º 1
0
        down_time = binning(time, i, b_bin_steps)
        down_flux = binning(flux, i, b_bin_steps)

        eep = EEP(down_time, down_flux)
        eep.estimate()
        print "binned N: ", len(eep.flux), eep.get_params()
        results = eep.get_params()

        width = max(results[0] * 3.0, 0.4)
        # 3 times of the width. The data point at zero time
        # must be centered.
        half_width = int((width / 2.0) * base_sampling)
        center_index = np.searchsorted(time, results[3])
        flux_cut = flux[max(center_index - half_width, 0) : min(center_index + half_width + 1, len(flux))]

        pl.subplot(122)
        pl.step(eep.time, eep.flux, color=colors[i % len(colors)], marker="x", where="mid")

        v = pl.axis()
        x = np.linspace(v[0], v[1], 1000)
        y = eep.gaussian_step(eep.p1, x)
        pl.plot(x, y, color=colors[i % len(colors)], ls="--", lw=2)

    v = pl.axis()
    # pl.axis([-0.5, 0.5, v[2], v[3]])
    pl.grid()
    pl.title("b: %.2f, a: %.1f AU, d:%.1f km" % (b, a, d))
    pl.xlabel("Time/seconds")
    pl.ylabel("Scaled flux")
    pl.show()