def gamma_correction(arr, gamma):
    """Perform gamma correction *g* to an array *arr*, which is assumed
    to be in the range [0.0,1.0], and return the resulting array (same
    range). 
    """
    return arr ** (1.0 / gamma)
