human
Complete this python program:
def createLinearRamp(win, rampType=None):
assistant
#Here is the Python code you requested.

    """Generate the Nx3 values for a linear gamma ramp on the current platform.
    This uses heuristics about known graphics cards to guess the \rampType\ if
    none is explicitly given.
    Much of this work is ported from LoadIdentityClut.m, by Mario Kleiner
    for the psychtoolbox
    rampType 0 : an 8-bit CLUT ranging 0:1
    This is seems correct for most windows machines and older OS X systems
    Known to be used by:
    OSX 10.4.9 PPC with GeForceFX-5200
    rampType 1 : an 8-bit CLUT ranging (1/256.0):1
    For some reason a number of macs then had a CLUT that (erroneously?)
    started with 1/256 rather than 0. Known to be used by:
    OSX 10.4.9 with ATI Mobility Radeon X1600
    OSX 10.5.8 with ATI Radeon HD-2600
    maybe all ATI cards?
    rampType 2 : a 10-bit CLUT ranging 0:(1023/1024)
    A slightly odd 10-bit CLUT that doesn\t quite finish on 1.0!
    Known to be used by:
    OSX 10.5.8 with Geforce-9200M (MacMini)
    OSX 10.5.8 with Geforce-8800
    rampType 3 : a nasty, bug-fixing 10bit CLUT for crumby OS X drivers
    Craziest of them all for Snow leopard. Like rampType 2, except that
    the upper half of the table has 1/256.0 removed?!!
    Known to be used by:
    OSX 10.6.0 with NVidia Geforce-9200M
    """
    def _versionTuple(v):
        return tuple(map(int, v.split('.')))
    if (rampType is None):
        driver = pyglet.gl.gl_info.get_renderer()
        osxVer = platform.mac_ver()[0]
        if osxVer:
            osxVerTuple = _versionTuple(osxVer)
            if ('NVIDIA' in driver):
                if (_versionTuple('10.5') < osxVerTuple < _versionTuple('10.6')):
                    rampType = 2
                elif (_versionTuple('10.6') < osxVerTuple):
                    rampType = 3
                else:
                    rampType = 1
            else:
                rampType = 1
        else:
            rampType = 0
    if (rampType == 0):
        ramp = numpy.linspace(0.0, 1.0, num=256)
    elif (rampType == 1):
        ramp = numpy.linspace(old_div(1, 256.0), 1.0, num=256)
    elif (rampType == 2):
        ramp = numpy.linspace(0, old_div(1023.0, 1024), num=1024)
    elif (rampType == 3):
        ramp = numpy.linspace(0, old_div(1023.0, 1024), num=1024)
        ramp[512:] = (ramp[512:] - old_div(1, 256.0))
    logging.info(('Using    gamma    ramp    type:    %i' % rampType))
    return ramp