def __stretch__(p,s1,f1):
    """ If a point has coordinate p  when the steep/flat points are at s0/f0,
        this returns its coordinates when the steep/flat points are at s1/f1.
        This is necessary to preserve the colourmap features.
    """
    s0 = 0.3125
    f0 = 0.75
    dsf = f0 - s0

    if p <= s0:
        return p*s1/s0
    elif p <= f0:
        return ( (p-s0)*f1 + (f0-p)*s1 )/dsf
    else:
        return ( (p-f0) + (1.-p)*f1 )/(1-f0)