Calibrate your monitor's gamma using a photometer and ArgyllCMS to generate gamma correction tables compatible with Psychtoolbox.
Ubuntu:
sudo apt-get install argyll
Other OS:
Download from ArgyllCMS Installation Guide.
Ensure ArgyllCMS is in your PATH:
dispwin -?
With Python 3 installed:
pip3 install numpy scipy matplotlib
- Start the Script
python3 photometer_gamma_table.py
-
Follow Prompts
- Enter Base Name: e.g.,
calibration_session1
. - Select Display Device: Choose from listed options.
- Set Number of Patches:
- Grayscale patches (e.g.,
64
, or0
to skip). - Color patches per channel (e.g.,
64
, or0
to skip). - At least one must be greater than zero.
- Grayscale patches (e.g.,
- Enter Base Name: e.g.,
-
Calibrate the Photometer (for colormunki photo)
- Calibration Mode:
- Place the photometer sensor face down, button facing you.
- Set to calibration mode (bottom-left position).
-
Switch to Measurement Mode
- Set to measurement mode (bottom-middle position).
-
Measure Test Patches
- Follow on-screen instructions.
- Position sensor against the monitor.
-
Complete Calibration
- Wait for processing to finish.
- Files saved in a directory named after your base name and display number.
Example MATLAB/Octave code:
% Load gamma table
gammaTable = load('path_to_gamma_table.txt');
% Open window
screenNumber = max(Screen('Screens'));
[windowPtr, ~] = Screen('OpenWindow', screenNumber);
% Apply gamma table
[oldTable, success] = Screen('LoadNormalizedGammaTable', windowPtr, gammaTable);
% Check success
if success
disp('Gamma table loaded successfully.');
else
disp('Failed to load gamma table.');
end
% ... Your experiment code ...
% Restore original gamma table
Screen('LoadNormalizedGammaTable', windowPtr, oldTable);
Screen('CloseAll');
Refer to Psychtoolbox documentation for details.