import random


def des_num_exposures(bands=''):
    """
    Sample from the effective number of exposures for DES
    """
    # Figure 5 in https://arxiv.org/pdf/1501.02802.pdf
    dist = {'g': {'VALUES': [1, 2, 3, 4, 5, 6, 7, 8, 9],
                  'WEIGHTS': [0.040, 0.113, 0.267, 0.311, 0.178, 0.062, 0.019, 0.007, 0.003]},
            'r': {'VALUES': [1, 2, 3, 4, 5, 6, 7, 8, 9],
                  'WEIGHTS': [0.041, 0.119, 0.284, 0.321, 0.167, 0.046, 0.014, 0.006, 0.002]},
            'i': {'VALUES': [1, 2, 3, 4, 5, 6, 7, 8, 9],
                  'WEIGHTS': [0.043, 0.121, 0.291, 0.334, 0.165, 0.033, 0.009, 0.003, 0.001]},
            'z': {'VALUES': [1, 2, 3, 4, 5, 6, 7, 8, 9],
                  'WEIGHTS': [0.039, 0.106, 0.272, 0.332, 0.183, 0.048, 0.013, 0.005, 0.002]},
            'Y': {'VALUES': [1, 2, 3, 4, 5, 6, 7, 8, 9],
                  'WEIGHTS': [0.034, 0.074, 0.195, 0.305, 0.241, 0.099, 0.035, 0.012, 0.005]}
            }
    return [random.choices(dist[b]['VALUES'], dist[b]['WEIGHTS'])[0] for b in bands.split(',')]