Estimate the convective turnover time from mass, using the method described
    in Cook+ (2014ApJ...785...10C).

    mass_g - UCD mass in grams.

    Returns: the convective turnover timescale in seconds.

    Masses larger than 1.3 Msun are out of range and yield NaN. If the mass is
    <0.1 Msun, the turnover time is fixed at 70 days.

    The Cook method was inspired by the description in McLean+
    (2012ApJ...746...23M). It is a hybrid of the method described in Reiners &
    Basri (2010ApJ...710..924R) and the data shown in Kiraga & Stepien
    (2007AcA....57..149K). However, this version imposes the 70-day cutoff in
    terms of mass, not spectral type, so that it is entirely defined in terms
    of a single quantity.

    There are discontinuities between the different break points! Any future
    use should tweak the coefficients to make everything smooth.

def tauc_from_mass (mass_g):
    """Estimate the convective turnover time from mass, using the method described
    in Cook+ (2014ApJ...785...10C).

    mass_g - UCD mass in grams.

    Returns: the convective turnover timescale in seconds.

    Masses larger than 1.3 Msun are out of range and yield NaN. If the mass is
    <0.1 Msun, the turnover time is fixed at 70 days.

    The Cook method was inspired by the description in McLean+
    (2012ApJ...746...23M). It is a hybrid of the method described in Reiners &
    Basri (2010ApJ...710..924R) and the data shown in Kiraga & Stepien
    (2007AcA....57..149K). However, this version imposes the 70-day cutoff in
    terms of mass, not spectral type, so that it is entirely defined in terms
    of a single quantity.

    There are discontinuities between the different break points! Any future
    use should tweak the coefficients to make everything smooth.

    """
    m = mass_g / cgs.msun
    return np.piecewise (m,
                         [m < 1.3,
                          m < 0.82,
                          m < 0.65,
                          m < 0.1],
                         [lambda x: 61.7 - 44.7 * x,
                          25.,
                          lambda x: 86.9 - 94.3 * x,
                          70.,
                          np.nan]) * 86400.