def test_age_weights_are_mathematically_sensible():
    t_obs = 11.0
    mah_params = np.array(list(DEFAULT_MAH_PARAMS.values()))
    ms_params = np.array(list(DEFAULT_MS_PARAMS.values()))
    q_params = np.array(list(DEFAULT_Q_PARAMS.values()))
    res = _get_sfh_tables(mah_params, ms_params, q_params)
    (t_table, lgt_table, dt_table, sfh_table, logsm_table) = res
    lgt_ages = (np.linspace(5.5, 10.5, 50) - 9.0)
    lgt_age_bin_edges = _get_lg_age_bin_edges(lgt_ages)
    lgt_birth_bin_edges = _get_lgt_birth(t_obs, lgt_age_bin_edges)
    age_weights = _get_age_weights_from_tables(lgt_birth_bin_edges, lgt_table, logsm_table)
    assert (age_weights.shape == lgt_ages.shape)
    assert np.allclose(age_weights.sum(), 1.0)
def test_age_weights_are_mathematically_sensible():
    t_obs = 11.0
    mah_params = np.array(list(DEFAULT_MAH_PARAMS.values()))
    ms_params = np.array(list(DEFAULT_MS_PARAMS.values()))
    q_params = np.array(list(DEFAULT_Q_PARAMS.values()))
    res = _get_sfh_tables(mah_params, ms_params, q_params)
    (t_table, lgt_table, dt_table, sfh_table, logsm_table) = res
    lgt_ages = (np.linspace(5.5, 10.5, 50) - 9.0)
    lgt_age_bin_edges = _get_lg_age_bin_edges(lgt_ages)
    lgt_birth_bin_edges = _get_lgt_birth(t_obs, lgt_age_bin_edges)
    age_weights = _get_age_weights_from_tables(lgt_birth_bin_edges, lgt_table, logsm_table)
    assert (age_weights.shape == lgt_ages.shape)
    assert np.allclose(age_weights.sum(), 1.0)