def extinction_total_to_selective_ratio(band, photsys, match_legacy_surveys=False) :
    """Return the linear coefficient R_X = A(X)/E(B-V) where
    A(X) = -2.5*log10(transmission in X band),
    for band X in 'G','R' or 'Z' when
    photsys = 'N' or 'S' specifies the survey (BASS+MZLS or DECALS),
    or for band X in 'G', 'BP', 'RP' when photsys = 'G' (when gaia dr2)
    or for band X in 'W1', 'W2', 'W3', 'W4' when photsys is either 'N' or 'S'
    E(B-V) is interpreted as SFD.
    Args:
        band : 'G', 'R', 'Z', 'BP', 'RP', 'W1', 'W2', 'W3', or 'W4'
        photsys : 'N' or 'S'
    Returns:
        scalar, total extinction A(band) = -2.5*log10(transmission(band))
    """
    if match_legacy_surveys :
        # Based on the fit from the columns MW_TRANSMISSION_X and EBV
        # for the DR8 target catalogs and propagated in fibermaps
        # R_X = -2.5*log10(MW_TRANSMISSION_X) / EBV
        # It is the same value for the N and S surveys in DR8 and DR9 catalogs.
        R={"G_N":3.2140,
           "R_N":2.1650,
           "Z_N":1.2110,
           "G_S":3.2140,
           "R_S":2.1650,
           "Z_S":1.2110,
           "G_G":2.512,
           "BP_G":3.143,
           "RP_G":1.663,
        }
    else :
        # From https://desi.lbl.gov/trac/wiki/ImagingStandardBandpass
        # DECam u  3881.6   3.994
        # DECam g  4830.8   3.212
        # DECam r  6409.0   2.164
        # DECam i  7787.5   1.591
        # DECam z  9142.7   1.211
        # DECam Y  9854.5   1.063
        # BASS g  4772.1   3.258
        # BASS r  6383.6   2.176
        # MzLS z  9185.1   1.199
        # Consistent with the synthetic magnitudes and function dust_transmission

        R={"G_N":3.258,
           "R_N":2.176,
           "Z_N":1.199,
           "G_S":3.212,
           "R_S":2.164,
           "Z_S":1.211,
           "G_G":2.197,
           "BP_G":2.844,
           "RP_G":1.622,
        }

    # Add WISE from
    # https://github.com/dstndstn/tractor/blob/main/tractor/sfd.py#L23-L35
    R.update({
        'W1_N': 0.184,
        'W2_N': 0.113,
        'W3_N': 0.0241,
        'W4_N': 0.00910,
        'W1_S': 0.184,
        'W2_S': 0.113,
        'W3_S': 0.0241,
        'W4_S': 0.00910
        })

    assert(band.upper() in ["G","R","Z","BP","RP",'W1','W2','W3','W4'])
    assert(photsys.upper() in ["N","S","G"])
    return R["{}_{}".format(band.upper(),photsys.upper())]