Monitor Calibration (Using ColorCAL II MK) Questions

OS (e.g. Win10):
PsychoPy version (e.g. 3.7):
**Standard Standalone? (y)
What are you trying to achieve?:

Hi,

I am trying to gamma calibrate our lab-monitor ViewPixx using a ColorCALII-MK photometer.

I have tried some tests to measure the current values:

I was able to connect it using PsychoPy Monitor Center and did some measurements. It appears that the monitor I am using has a gamma value of ~2.1. When I press “Plot Gamma” on Monitor Center, I get the error message you can see in the below picture.

I don’t think I really need to see the plots, but still, it would be nice. If you have an idea about what may be causing such errors, or how to fix them, I’d be happy to hear!

And the main thing I’d like to ask is: If my understanding is correct, I need to linearize the gamma (I should have a gamma value of 1) in order to use this monitor for psychophysics experiments we plan to conduct in our lab. From what I read, I had the impression that I should use an inverse function on this gamma value to “correct” it, so that the input/output relationship is not following a power law, but a linear line after the correction. Is there something I can follow that could help me apply this? Or is this even possible to conduct using software, or is this more of a hardware-dependent property?

Thank you very much in advance!

I’d be happy to provide more specific information about the system if you think it’d help.

Hi There,

This is interesting (and I totally get why it is nice to see the plots).Please could you copy and paste the full message from the stdout window for us there?

In terms of applying the gamma correction itself. If my memory serves me correctly, PsychoPy should apply the gamma correction for you (although this is following from a very old blog post of mine and with slightly differing hardware https://psychskills.wordpress.com/2017/04/20/monitor-calibration/) - for sanity it is useful to have the plots as you say. In this post I have a very old “measure luminance” script, it would need adapting but may provide a starting point. (As a start… lets see if we can figure out that error instead :joy:)

Becca

Hi,

Thank you for the prompt response!

The complete message is as follows, there is nothing else that pops out in the standout window:

Traceback (most recent call last):
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\monitors\MonitorCenter.py”, line 1019, in plotGamma
if lumsPre != None:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Just for the sake of completeness, I ran the calibration/test with several different number of calibration points (8,32,64) and I still encounter the same error.

During the test/calibration I see these outputs in the standout window (This is a short example just to demonstrate, made with 4 calibration points):

At DAC value 0 : 0.07cd/m^2
At DAC value 85 : 28.95cd/m^2
At DAC value 170 : 54.88cd/m^2
At DAC value 255 : 75.64cd/m^2
At DAC value 85 : 6.99cd/m^2
At DAC value 170 : 13.40cd/m^2
At DAC value 255 : 18.52cd/m^2
At DAC value 85 : 17.81cd/m^2
At DAC value 170 : 34.87cd/m^2
At DAC value 255 : 48.53cd/m^2
At DAC value 85 : 3.45cd/m^2
At DAC value 170 : 6.69cd/m^2
At DAC value 255 : 9.17cd/m^2
171268.3724 INFO Using gamma ramp type: 0
171268.6022 EXP Created window1 = Window(allowGUI=True, allowStencil=False, args=UNKNOWN, autoLog=True, bitsMode=UNKNOWN, blendMode=‘avg’, color=array([ 0., 0., 0.]), colorSpace=‘rgb’, fullscr=UNKNOWN, gamma=array([[ 2.28981566],
[ 2.21966434],
[ 2.19342852]], dtype=float32), kwargs=UNKNOWN, lms=UNKNOWN, monitor=<psychopy.monitors.calibTools.Monitor object at 0x04A195F0>, multiSample=False, name=‘window1’, numSamples=2, pos=[0, 0], screen=0, size=array([1920, 1200]), stereo=False, units=‘norm’, useFBO=False, useRetina=False, viewOri=0.0, viewPos=None, viewScale=None, waitBlanking=True, winType=‘pyglet’)
171268.6024 WARNING Use of rgb arguments to stimuli are deprecated. Please use color and colorSpace args instead
171268.6434 EXP Created unnamed TextStim = TextStim(alignHoriz=‘center’, alignVert=‘center’, antialias=True, autoLog=True, bold=False, color=array([ 1., -1., -1.]), colorSpace=‘rgb’, contrast=1.0, depth=0, flipHoriz=False, flipVert=False, font=’’, fontFiles=[], height=0.1, italic=False, name=‘unnamed TextStim’, opacity=1.0, ori=0.0, pos=array([ 0. , -0.85]), rgb=array([ 1., -1., -1.]), text=newstr(…), units=‘norm’, win=Window(…), wrapWidth=1)
171268.6607 EXP Created unnamed PatchStim = PatchStim(autoDraw=False, autoLog=True, blendmode=‘avg’, color=array([ 1., 1., 1.]), colorSpace=‘rgb’, contrast=1.0, depth=0, interpolate=False, mask=‘none’, maskParams=None, name=‘unnamed PatchStim’, opacity=1.0, ori=0.0, phase=array([ 0., 0.]), pos=array([ 0., 0.]), rgbPedestal=array([ 0., 0., 0.]), sf=array([ 3.75 , 2.34375]), size=array([ 2., 2.]), tex=ndarray(…), texRes=128, units=‘norm’, win=Window(…))
171268.6608 WARNING Use of rgb arguments to stimuli are deprecated. Please use color and colorSpace args instead
171268.6625 EXP Created unnamed PatchStim = PatchStim(autoDraw=False, autoLog=True, blendmode=‘avg’, color=array([ 0.8, 0.8, 0.8]), colorSpace=‘rgb’, contrast=1.0, depth=0, interpolate=False, mask=‘none’, maskParams=None, name=‘unnamed PatchStim’, opacity=1.0, ori=0.0, phase=array([ 0., 0.]), pos=array([ 0., 0.]), rgbPedestal=array([ 0., 0., 0.]), sf=array([ 1., 1.]), size=array([ 1., 1.]), tex=‘sqr’, texRes=128, units=‘norm’, win=Window(…))
171270.6415 DATA Keypress: space
171270.6571 EXP unnamed TextStim: text = ‘Q to quit at any time’
171270.6571 EXP unnamed PatchStim: color = ‘[-1. -1. -1.] (rgb)’
171278.3418 EXP unnamed PatchStim: color = ‘[-0.33333333 -0.33333333 -0.33333333] (rgb)’
171285.9621 EXP unnamed PatchStim: color = ‘[ 0.33333333 0.33333333 0.33333333] (rgb)’
171293.5963 EXP unnamed PatchStim: color = ‘[ 1. 1. 1.] (rgb)’
171301.2267 EXP unnamed PatchStim: color = ‘[-0.33333333 -1. -1. ] (rgb)’
171308.8774 EXP unnamed PatchStim: color = ‘[ 0.33333333 -1. -1. ] (rgb)’
171316.5252 EXP unnamed PatchStim: color = ‘[ 1. -1. -1.] (rgb)’
171324.1471 EXP unnamed PatchStim: color = ‘[-1. -0.33333333 -1. ] (rgb)’
171331.7814 EXP unnamed PatchStim: color = ‘[-1. 0.33333333 -1. ] (rgb)’
171339.3931 EXP unnamed PatchStim: color = ‘[-1. 1. -1.] (rgb)’
171347.0224 EXP unnamed PatchStim: color = ‘[-1. -1. -0.33333333] (rgb)’
171354.6589 EXP unnamed PatchStim: color = ‘[-1. -1. 0.33333333] (rgb)’
171362.2912 EXP unnamed PatchStim: color = ‘[-1. -1. 1.] (rgb)’

I hope this helps elaborate it a bit more!

Best,
Umut

Hi There,

OK so the error itself is because this line

if lumsPre!= None:

is testing if lumsPre exists (if it is “True”) and what python wants is for the function any() to be used instead (https://beginnersbook.com/2019/03/python-any-function/#:~:text=Python%20any()%20function%20accepts,any()%20method%20returns%20false.).

Normally if we were debugging, we might replace that line in the script (accessed using the path in the error message) to read:
if any(lumsPre):

However, first can I suggest updating your psychopy to a more recent version if possible. Looking at the equivilent script in my version (2020.2.4) it looks like this line has been altered and it might fix your problem.

Thanks,
Becca

Hi,

I’m sorry for responding so late. In the meantime, I updated my PsychoPy to the latest version, and made the changes you suggested, but now I am encountered with a new error:

Traceback (most recent call last):
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\monitors\MonitorCenter.py”, line 1028, in plotGamma
if lumsPre.any() != None:
AttributeError: ‘NoneType’ object has no attribute ‘any’

Also, when I do the calibration, I don’t get a set of values, or something to save anymore, it gives me this error:

Traceback (most recent call last):
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\monitors\MonitorCenter.py”, line 830, in onCalibGammaBtn
inputDlg = GammaLumValsDlg(parent=self, levels=lumLevels)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\monitors\MonitorCenter.py”, line 1116, in init
butBox.Add(btnOK, 1, wx.BOTTOM | wx.ALIGN_RIGHT, pad)
wx._core.wxAssertionError: C++ assertion “!(flags & wxALIGN_RIGHT)” failed at …\src\common\sizer.cpp(2098) in wxBoxSizer::DoInsert(): Horizontal alignment flags are ignored in horizontal sizers

I’m really confused and would definitely use some help!

Hi Becca,
Sorry for bumping up this old post, and apologies if this should be a separate post. Thank you for sharing that wonderful script!
I have been using your script with a CRS ColorCAL MK2 and it’s been working fine. However, it takes around at least 30 minutes to run through the script. In your experience with the PRS photometer, is it normal for the script to take this long?

Hi Tim,

No problem. So I must admit this is a ghost of scripty past - it is possible that the script isn’t as efficient as it could be because I created it when I was not as familiar with python (although I think the code is quite simple, so it should be ok). However, I do remember that when I ran it, it did take some time (half an hour sounds faster than it was my end to be fair!) so I do think that is normal.

Becca