def self_affine_psd(q, pref, hurst, onedim=False):
    """Ideal self-affine power spectrum, dependent only on prefactor and Hurst exponent."""
    exp = -2 * (hurst + 1)
    if onedim:
        exp = -1 - 2 * hurst
    return pref * q**exp