def extract_data(mask, dra, ddc, dra_err, ddc_err, ra_rad, dc_rad, ra_dc_cor=None):
    """Get a clean sample based on mask

    Parameters
    ----------
    mask : array of boolean
        mask for extract data
    dra/ddc : array of float
        R.A.(*cos(Dec.))/Dec. differences
    dra_err/ddc_err : array of float
        formal uncertainty of dra(*cos(dc_rad))/ddc
    ra_rad/dc_rad : array of float
        Right ascension/Declination in radian

    Returns
    ----------
    dra_new/ddc_new: array of float
        R.A.(*cos(Dec.))/Dec for the clean sample. differences
    dra_err_new/ddc_err_new: array of float
        formal uncertainty of dra(*cos(dc_rad))/ddc for the clean sample
    ra_rad_new/dc_rad_new: array of float
        Right ascension/Declination in radian for the clean sample
    ra_dc_cor_new: array of float
        covariance/correlation coefficient between dra and ddc for the clean sample
    """

    # Extract the clean sample
    dra_new, ddc_new = dra[mask], ddc[mask]
    dra_err_new, ddc_err_new = dra_err[mask], ddc_err[mask]
    ra_rad_new, dc_rad_new = ra_rad[mask], dc_rad[mask]

    if ra_dc_cor is None:
        ra_dc_cor_new = ra_dc_cor
    else:
        ra_dc_cor_new = ra_dc_cor[mask]

    return dra_new, ddc_new, dra_err_new, ddc_err_new, ra_rad_new, dc_rad_new, ra_dc_cor_new