Ejemplo n.º 1
0
def completeness_corrections(fakefile, mag_bins, mag2=True):
    '''
    get the completeness fraction for a given list of magnitudes.
    for details see ResolvedStellarPops.galaxies.asts.ASTs.__doc__.

    Parameters
    ----------
    fakefile : str
        match fake file (mag1in, mag2in, mag1diff, mag2diff)
    mag_bins : array
        array of magnitudes to find completeness interpolation
    mag2 : bool
        True use fcomp2, False use fcomp1

    Returns
    -------
    ast_c : array len(mag_bins)
        completeness corrections to mag_bins
    '''
    assert os.path.isfile(fakefile), \
        'completeness corrections: fakefile %s not found' % fakefile
    ast = ASTs(fakefile)
    ast.completeness(combined_filters=True, interpolate=True)

    if mag2:
        ast_c = ast.fcomp2(mag_bins)
    else:
        ast_c = ast.fcomp1(mag_bins)

    return ast_c
Ejemplo n.º 2
0
def limiting_mag(fakefile, comp_frac):
    """
    find the completeness fraction in each filter of the fake file
    for details see ResolvedStellarPops.galaxies.asts.ASTs.__doc__.

    Parameters
    ----------
    fakefile : str
        match fake file (mag1in, mag2in, mag1diff, mag2diff)
    comp_frac : float
        completeness fraction e.g, 0.9 means 90% completeness

    Returns
    -------
    comp1, comp2 : float, float
        the completeness fraction in each filter
    """
    assert os.path.isfile(fakefile), \
        'limiting mag: fakefile %s not found' % fakefile
    ast = ASTs(fakefile)
    ast.completeness(combined_filters=True, interpolate=True)
    comp1, comp2 = ast.get_completeness_fraction(comp_frac)
    return comp1, comp2