Returns distance modulus given d in parsec.

def distancemodulus(d):
    """Returns distance modulus given d in parsec.
    """
    if type(d)==Quantity:
        x = d.to('pc').value
    else:
        x = d #assumed to be pc

    if np.size(x)>1:
        d = np.atleast_1d(x)
    return 5*np.log10(x/10)