예제 #1
0
def test_getNewTimes_with_half_phase_two_day_bin():
    """
    Test to make sure times are shifted
    properly if the phase optional argument
    is used with a two day bin.
    """
    times = np.random.uniform(0, 10, 75)
    newtimes = wm.getNewTimes(times, 2.)
    newtimes2 = wm.getNewTimes(times, 2., phase=0.5)
    assert np.round((np.min(newtimes2) - np.min(newtimes)), 7) == 1.000
예제 #2
0
def test_getNewTimes_one_day_bin_ten_days():
    """
    Test to make sure `getNewTimes` returns ten elements
    when 75 elements are entered over a ten day span with
    one day binning in place.
    """
    times = np.random.uniform(0, 10, 75)
    newtimes = wm.getNewTimes(times, 1.)
    print(len(newtimes))
    assert len(newtimes) == 10
예제 #3
0
def test_big_gaps_getNewVals():
    """
    Ensure getNewVals routine can handle big gaps in times
    """
    timebin = 1.
    times = np.concatenate((np.random.uniform(0, 10, 50),
                           np.random.uniform(30, 40, 50)))
    newtimes = wm.getNewTimes(times, timebin)
    rvs = np.random.normal(loc=0, scale=5, size=100)
    uncs = np.random.normal(loc=1., scale=0.5, size=100)
    newRVs, newUncs = wm.getNewVals(newtimes, times, rvs,
                                    uncs, timebin=timebin)
    fins = np.where(np.isfinite(newUncs))
    newRVs = newRVs[fins]
    newUncs = newUncs[fins]
    newtimes = newtimes[fins]
    assert np.median(newUncs) < np.median(uncs)