Hi there,
OS windows 7
PsychoPy version 1.85.6
Standard Standalone? (y/n) Yes
Although, also having the same problems on windows 10, PsychoPy v2020.2.10 with the same script below and error messages.
What are you trying to achieve?:
I’m trying to create colours in DKL space and convert into RGB space using the dkl2rgb function. Below is a script where I am just trying to create the colours, however I only keep getting errors:
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import division
from psychopy.tools.colorspacetools import dkl2rgb
from psychopy import visual, event, core, misc
import numpy as np
win = visual.Window((800, 800), allowGUI=False, units = 'pix', color = "darkgrey")
midcol = [0, 191, 1]
midcolour = dkl2rgb(midcol, conversionMatrix = 'none')
circle1 = visual.Circle(win, fillColor = midcolour, radius = 40, pos = [0, 0], fillColorSpace='dkl')
while not event.getKeys():
circle1.draw()
win.flip()
win.close()
core.quit()
This is the error I get:
Traceback (most recent call last):
File "I:\Giessen postdoc\testing colours dkl.py", line 59, in <module>
midcolour = dkl2rgb(midcol, conversionMatrix = 'none')
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\tools\colorspacetools.py", line 40, in dkl2rgb
if len(dkl.shape) == 3:
AttributeError: 'tuple' object has no attribute 'shape'
I then tried an array with this:
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import division
from psychopy.tools.colorspacetools import dkl2rgb
from psychopy import visual, event, core, misc
import numpy as np
win = visual.Window((800, 800), allowGUI=False, units = 'pix', color = "darkgrey")
midcol = np.asarray((0, 191, 1))
midcolour = dkl2rgb(midcol, conversionMatrix = 'none')
circle1 = visual.Circle(win, fillColor = midcolour, radius = 40, pos = [0, 0], fillColorSpace='dkl')
while not event.getKeys():
circle1.draw()
win.flip()
win.close()
core.quit()
Then got this error message:
Traceback (most recent call last):
File "I:\Giessen postdoc\testing colours dkl.py", line 59, in <module>
midcolour = dkl2rgb(midcol, conversionMatrix = 'none')
File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\tools\colorspacetools.py", line 62, in dkl2rgb
rgb = numpy.dot(conversionMatrix, dkl_cartesian)
TypeError: Cannot cast array data from dtype('float64') to dtype('S32') according to the rule 'safe'
Any advice would be much appreciated.