def MTFfreq(MTFpos, MTF, modulation=0.2):
    """ Return the frequency for the requested modulation height. """

    mtf_freq = 0
    for f in range(len(MTFpos)):
        if MTF[f] < modulation:
            if f > 0:
                # Linear interpolation:
                x0 = MTFpos[f-1]
                x1 = MTFpos[f]
                y0 = MTF[f-1]
                y1 = MTF[f]

                m = (y1-y0)/(x1-x0)
                n = y0 - m*x0
                mtf_freq = (modulation-n)/m
            else:
                mtf_freq = MTFpos[f]
            
            break

    return mtf_freq