def mdwarf_subtype_from_sdsscolor(ri_color, iz_color):
<EOL>if np.isfinite(ri_color) and np.isfinite(iz_color):<EOL><INDENT>obj_sti = <NUM_LIT>*ri_color + <NUM_LIT>*(iz_color + <NUM_LIT>)<EOL>obj_sts = -<NUM_LIT>*ri_color + <NUM_LIT>*(iz_color + <NUM_LIT>)<EOL><DEDENT>else:<EOL><INDENT>obj_sti = np.nan<EOL>obj_sts = np.nan<EOL><DEDENT>if (np.isfinite(obj_sti) and np.isfinite(obj_sts) and<EOL>(obj_sti > <NUM_LIT>) and (obj_sti < <NUM_LIT>)):<EOL><INDENT>if ((obj_sti > <NUM_LIT>) and (obj_sti < <NUM_LIT>)):<EOL><INDENT>m_class = '<STR_LIT>'<EOL><DEDENT>if ((obj_sti > <NUM_LIT>) and (obj_sti < <NUM_LIT>)):<EOL><INDENT>m_class = '<STR_LIT>'<EOL><DEDENT>if ((obj_sti > <NUM_LIT>) and (obj_sti < <NUM_LIT>)):<EOL><INDENT>m_class = '<STR_LIT>'<EOL><DEDENT>if ((obj_sti > <NUM_LIT>) and (obj_sti < <NUM_LIT>)):<EOL><INDENT>m_class = '<STR_LIT>'<EOL><DEDENT>if ((obj_sti > <NUM_LIT>) and (obj_sti < <NUM_LIT>)):<EOL><INDENT>m_class = '<STR_LIT>'<EOL><DEDENT>if ((obj_sti > <NUM_LIT>) and (obj_sti < <NUM_LIT>)):<EOL><INDENT>m_class = '<STR_LIT>'<EOL><DEDENT>if ((obj_sti > <NUM_LIT>) and (obj_sti < <NUM_LIT>)):<EOL><INDENT>m_class = '<STR_LIT>'<EOL><DEDENT>if ((obj_sti > <NUM_LIT>) and (obj_sti < <NUM_LIT>)):<EOL><INDENT>m_class = '<STR_LIT>'<EOL><DEDENT>if ((obj_sti > <NUM_LIT>) and (obj_sti < <NUM_LIT>)):<EOL><INDENT>m_class = '<STR_LIT>'<EOL><DEDENT>if ((obj_sti > <NUM_LIT>) and (obj_sti < <NUM_LIT>)):<EOL><INDENT>m_class = '<STR_LIT>'<EOL><DEDENT><DEDENT>else:<EOL><INDENT>m_class = None<EOL><DEDENT>return m_class, obj_sti, obj_sts<EOL>
This calculates the M-dwarf subtype given SDSS `r-i` and `i-z` colors.

    Parameters
    ----------

    ri_color : float
        The SDSS `r-i` color of the object.

    iz_color : float
        The SDSS `i-z` color of the object.

    Returns
    -------

    (subtype, index1, index2) : tuple
        `subtype`: if the star appears to be an M dwarf, will return an int
        between 0 and 9 indicating its subtype, e.g. will return 4 for an M4
        dwarf. If the object isn't an M dwarf, will return None

        `index1`, `index2`: the M-dwarf color locus value and spread of this
        object calculated from the `r-i` and `i-z` colors.