Пример #1
0
def test_delta_t_hist():
    """Test histogram of all time lags."""
    times, values, errors = irregular_random(500)
    delta_ts = [pair[1] - pair[0] for pair in itertools.combinations(times, 2)]
    nbins = 50
    bins = np.linspace(0, max(times) - min(times), nbins + 1)
    npt.assert_allclose(cf.delta_t_hist(times, nbins),
                        np.histogram(delta_ts, bins=bins)[0], atol=2)
Пример #2
0
def test_delta_t_hist():
    """Test histogram of all time lags."""
    times, values, errors = irregular_random(500)
    delta_ts = [pair[1] - pair[0] for pair in itertools.combinations(times, 2)]
    nbins = 50
    bins = np.linspace(0, max(times) - min(times), nbins + 1)
    npt.assert_allclose(cf.delta_t_hist(times, nbins),
                        np.histogram(delta_ts, bins=bins)[0],
                        atol=2)
Пример #3
0
def test_normalize_hist():
    """Test normalization of histogram."""
    times, values, errors = irregular_random(500)
    delta_ts = [pair[1] - pair[0] for pair in itertools.combinations(times, 2)]
    nbins = 50
    bins = np.linspace(0, max(times) - min(times), nbins + 1)
    nhist = cf.normalize_hist(cf.delta_t_hist(times, nbins),
                              max(times) - min(times))
    npt.assert_allclose(nhist, np.histogram(delta_ts, bins=bins,
                                            density=True)[0], atol=0.01)
Пример #4
0
def test_normalize_hist():
    """Test normalization of histogram."""
    times, values, errors = irregular_random(500)
    delta_ts = [pair[1] - pair[0] for pair in itertools.combinations(times, 2)]
    nbins = 50
    bins = np.linspace(0, max(times) - min(times), nbins + 1)
    nhist = cf.normalize_hist(cf.delta_t_hist(times, nbins),
                              max(times) - min(times))
    npt.assert_allclose(nhist,
                        np.histogram(delta_ts, bins=bins, density=True)[0],
                        atol=0.01)