def _estimate_alpha(array, k):
    """
    Estimate the alpha parameter using the power spectrum of the input array.
    """
    fp = np.fft.fft2(array)
    fp_abs = abs(fp)
    log_power_spectrum = np.log(fp_abs**2)
    valid = (k != 0) & np.isfinite(log_power_spectrum)
    alpha = _log_slope(np.log(k[valid]), log_power_spectrum[valid])
    return alpha
Estimate the alpha parameter using the power spectrum of the input array.
pysteps/downscaling/rainfarm.py