Example #1
0
def mod_from_row(iso,
                 row,
                 props,
                 name_col='tmass_key',
                 rootdir=os.path.join(PROJECT_DIR, 'fit_results'),
                 halo_fraction=0.5,
                 tag=None,
                 **kwargs):

    kwargs.update({
        p: (np.float64(row[p]), np.float64(row['{}_unc'.format(p)]))
        for p in props if row[p] > 0 and row['{}_unc'.format(p)] > 0
    })
    if 'feh' in props:
        if np.isfinite(row['feh']):
            kwargs.update(
                {'feh': (np.float64(row['feh']), np.float64(row['feh_unc']))})
    name = row[name_col]
    if tag is not None:
        name = '{}_{}'.format(name, tag)
    kwargs.update({'name': name, 'directory': os.path.join(rootdir, name)})

    max_distance = min((1000. / (row['parallax'] - row['parallax_unc'])) * 2,
                       30000)
    kwargs['max_distance'] = max_distance
    kwargs['halo_fraction'] = halo_fraction
    mod = BasicStarModel(iso, **kwargs)
    mod.set_prior('distance', FlatPrior((0, max_distance)))
    AV_inf = get_AV_infinity(row['ra_1'], row['dec_1'])
    mod.set_prior('feh', FehPrior(halo_fraction=halo_fraction, local=False))
    mod.set_prior('AV', GaussianPrior(AV_inf, AV_inf / 2, bounds=(0, 5)))
    mod.set_bounds(mass=(0.1, 20), feh=iso.model_grid.get_limits('feh'))
    print(mod.mnest_basename)
    return mod
Example #2
0
def test_AV():
    from isochrones.extinction import get_AV_infinity
    AV = get_AV_infinity(299.268036, 45.227428)
    assert np.isclose(AV, 1.216)
Example #3
0
def test_AV():
    from isochrones.extinction import get_AV_infinity
    AV = get_AV_infinity(299.268036, 45.227428)
    assert np.isclose(AV, 1.216)