def __init__(self, name, colRGB, offset=0.15, delta=0.02, sound="", target=True):
		self.name = name

		# Set the colours up
		self.RGB = PyVSG.vsgTRIVIAL(colRGB[0], colRGB[1], colRGB[2])
		self.CIE = vsg.vsgSpaceToSpace(PyVSG.vsgCS_RGB, self.RGB, PyVSG.vsgCS_CIE1976)

		if sound:
			sound_path = path + "\\" + sound
			# print "sound_path = %s" % (sound_path)
			self.sound = pygame.mixer.Sound (sound_path)

		# Only target colours track their quest values
		self.target = target
		if target:
			print "offset is %f" % offset
			# For this experiment we vary CIE.a (i.e L*)
			var = self.CIE.a + offset
			self.delta = float(delta)
			self.quest = Quest.QuestObject(  var, # tGuess
							 0.3, # tGuessSd (sd of Gaussian)
							 0.7, # pThreshold
							 3.5, # beta
							 0.01, # delta
							 0.5,  # gamma
							 0.03  # grain
							 )
			print "Created %s" % (self.__str__())
        def presentExperimentTrial(self,curBlock,trial,whichPart,expNo,cols):

                #
                # Play the sound cue. 
                #
                def playAudioCue(self):

			# Play a sound until pygame has finished it
			def playAndWait(sound):
                                sound.play()
                                while pygame.mixer.get_busy():
                                        clock.tick(30)

			# Play the intro
                        clock = pygame.time.Clock()
                        playAndWait(self.carrierSound)

			# And the colour sound
			playAndWait(trial.colour.sound)

			# The same?
                        playAndWait(self.sameSound)

                # start of presentExperimentTrial.
		# get the left and right colours out of the list and set them
		leftCol = cols[0]
		leftCol_RGB = leftCol.asRGB()
		leftCol_CIE = leftCol.asCIE()

		self.firstStim.parameters.color = list(leftCol_RGB)
		
		rightCol = cols[1]
		rightCol_RGB = rightCol.asRGB()
		rightCol_CIE = rightCol.asCIE()

		self.secondStim.parameters.color = list(rightCol_RGB)

                # First clear screen and wait for some specified time
                
                # VE:
                self.setAndPresentStimulus([])
                # VISAGE
                vsg.vsgSetDrawPage(0)
                vsg.vsgSetDisplayPage(1)

                time.sleep(self.experiment.preFixationDelay)

                # VE:
                self.presentStimulus(self.viewport_fixation) #show fixation cross
                # VISAGE:
                rgbWhite = PyVSG.vsgTRIVIAL(1.0, 1.0, 1.0)
		labWhite = vsg.vsgSpaceToSpace(PyVSG.vsgCS_RGB, rgbWhite, PyVSG.vsgCS_CIE1976)
		
		vsg.vsgSetDrawColour(labWhite)
                vsg.vsgDrawRect(0,0,10,2)
                vsg.vsgDrawRect(0,0,2,10)
                vsg.vsgSetDisplayPage(0)
                
                # Play the audio cue and wait
                playAudioCue(self)
                time.sleep(self.experiment.postFixationDelay)

                # VE:
                self.setAndPresentStimulus([self.fix1, self.fix2,self.firstStim, self.secondStim]) #fixation + first pic + second pic
                # VISAGE
                vsg.vsgSetDrawPage(1)
                # cross
		vsg.vsgSetDrawColour(labWhite)
                vsg.vsgDrawRect(0,0,10,2)
                vsg.vsgDrawRect(0,0,2,10)
                # left box
		vsg.vsgSetDrawColour(leftCol_CIE)
                vsg.vsgDrawRect(-125, 0, 100, 100)
                # right box
		vsg.vsgSetDrawColour(rightCol_CIE)
                vsg.vsgDrawRect(125, 0, 100, 100)
                # switch to display 1
                vsg.vsgSetDisplayPage(1)
                
                responded = False
                timeElapsed = False
                pygame.event.clear() #discount any keypresses
                responseStart = time.time()
                while not responded: 
                        # VE: self.setAndPresentStimulus([self.fix1, self.fix2,self.firstStim, self.secondStim]) #fixation + first pic + second pic
                        for event in pygame.event.get(pygame.KEYDOWN):
                                if event.key == self.experiment.sameResp or event.key == self.experiment.diffResp:
                                        response = event.key
                                        rt = time.time() - responseStart
                                        pygame.event.clear()
                                        responded = True
                                        break

		# Was the response correct
                isRight = self.isResponseCorrect(response, leftCol, rightCol)
		dist = leftCol.calculateColourDistance(rightCol)

		
		print "presentExperimentTrial: correct:%s time:%f dist:%s" % (isRight, rt, dist)

		# Dump run to results file.
		results = []
		results.append(expNo)
		results.append(leftCol.name)
		results.append(trial.type)
		results.append(isRight)
		results.append(leftCol.asCIEstr())
		results.append(rightCol.asCIEstr())
		results.append(dist)
		results.append(rt)
		self.experiment.storeResults(results)
		
		
		return isRight
	def setColourCIE(self, a, b, c):
		self.CIE = PyVSG.vsgTRIVIAL(a, b, c)
		self.RGB = vsg.vsgSpaceToSpace(PyVSG.vsgCS_CIE1976, self.CIE, PyVSG.vsgCS_RGB)