Skip to content

Commit ee474fd

Browse files
committed
A little more bookkeeping to keep things moving faster when parpool crashes.
1 parent 53cbe7b commit ee474fd

File tree

1 file changed

+45
-21
lines changed

1 file changed

+45
-21
lines changed

code/analysis/monitorGamutInLSPlane/makeMonitorGamutFigure.m

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,29 @@
77
figureDir = getpref('ColorTracking','figureSavePath');
88

99
%% Load typical calibration file from the experiment
10-
% whichCalFile = 'ViewSonicG220fb_670.mat';
11-
whichCalFile = 'ViewSonicG220fb.mat';
12-
whichCalNumber = 1;
10+
whichExperiment = 'detection';
11+
switch (whichExperiment)
12+
case 'tracking'
13+
whichCalFile = 'ViewSonicG220fb.mat';
14+
whichCalNumber = 1;
15+
nDeviceBits = 8;
16+
whichCones = 'ss2';
17+
NOAMBIENT = false;
18+
case 'detection'
19+
whichCalFile = 'ViewSonicG220fb_670.mat';
20+
whichCalNumber = 1;
21+
nDeviceBits = 12;
22+
whichCones = 'asano';
23+
NOAMBIENT = true;
24+
end
1325
resourcesDir = getpref('ColorTracking','CalDataFolder');
1426
load(fullfile(resourcesDir,whichCalFile),'cals');
1527
cal = cals{whichCalNumber};
1628

1729
%% Cone cal object
1830
calObjCones = ObjectToHandleCalOrCalStruct(cal);
1931

20-
% Make this a 12-bit device as far as the calibration file goes.
21-
%
22-
% HARDWARE FOR DETECTION WAS 14-BIT, BUT FOR TRACKING WAS LOWER.
23-
nDeviceBits = 12;
32+
% Make the bit depth correct as far as the calibration file goes.
2433
nDeviceLevels = 2^nDeviceBits;
2534
CalibrateFitGamma(calObjCones, nDeviceLevels);
2635
nPrimaries = calObjCones.get('nDevices');
@@ -33,8 +42,6 @@
3342
Scolor = calObjCones.get('S');
3443

3544
% Zero out ambient?
36-
% [HOW WAS THIS SET FOR THE EXPERIMENT???]
37-
NOAMBIENT = false;
3845
if (NOAMBIENT)
3946
calObjCones.set('P_ambient',zeros(size(calObjCones.get('P_ambient'))));
4047
end
@@ -43,14 +50,16 @@
4350
% what was loaded in the tracking code. In the detection code,
4451
% it was ComputeObserverFundamentals with parameters below, which
4552
% are not quite T_cones_ss2.
46-
%
47-
% psiParamsStruct.coneParams = DefaultConeParams('cie_asano');
48-
% psiParamsStruct.coneParams.fieldSizeDegrees = 2;
49-
% psiParamsStruct.coneParams.ageYears = 30;
50-
%T_cones = ComputeObserverFundamentals(psiParamsStruct.coneParams,Scolor);
51-
% [WHICH CONES WERE REALLY USED? SUBJECT AGES WERE 28, 29, and 33]
52-
load T_cones_ss2
53-
T_cones = SplineCmf(S_cones_ss2,T_cones_ss2,Scolor);
53+
switch (whichCones)
54+
case 'asano'
55+
psiParamsStruct.coneParams = DefaultConeParams('cie_asano');
56+
psiParamsStruct.coneParams.fieldSizeDegrees = 2;
57+
psiParamsStruct.coneParams.ageYears = 30;
58+
T_cones = ComputeObserverFundamentals(psiParamsStruct.coneParams,Scolor);
59+
case 'ss2'
60+
load T_cones_ss2
61+
T_cones = SplineCmf(S_cones_ss2,T_cones_ss2,Scolor);
62+
end
5463
SetSensorColorSpace(calObjCones,T_cones,Scolor);
5564

5665
%% XYZ cal object
@@ -67,10 +76,12 @@
6776
%
6877
% We report a nominal max contrast which is the contrast that would have been
6978
% shown had the 100% contrast Gabor image been in cosine phase. But ours
70-
% were in sin phase. The maximum value of the Gabor was 0.9221. We divide
79+
% were in sin phase. The maximum value of the Gabor was 0.9221 as we
80+
% found it by stepping through the tracking code, and 0.9608 as we found
81+
% it by looking at S.stmLE in the detection code saved data. We divide
7182
% our maximum gamut contrasts by this to get the real maximum contrast we
72-
% report.
73-
imageScaleFactor = 0.9221;
83+
% report. Not sure why there is a difference.
84+
imageScaleFactor = 0.9221; % 0.9221; 0.9608;
7485

7586
% XYZ
7687
USE1931XYZ = true;
@@ -102,8 +113,21 @@
102113
end
103114
bgxyY = XYZToxyY(bgXYZ);
104115
bgCones = PrimaryToSensor(calObjCones,bgPrimary);
116+
117+
% Print basic info and report on monitor
118+
fprintf('\nExperiment %s, calibration file %s, calibration number %d, calibration date %s\n', ...
119+
whichExperiment,whichCalFile,whichCalNumber,calObjXYZ.cal.describe.date);
120+
fprintf('\nNOAMBIENT = %d, cone option %s\n',NOAMBIENT,whichCones);
105121
fprintf('\nBackground x,y = %0.4f, %0.4f\n',bgxyY(1),bgxyY(2));
106-
fprintf('Background Y = %0.2f cd/m2, ambient %0.3f cd/m2\n\n',bgXYZ(2),ambientXYZ(2));
122+
fprintf('Background Y = %0.2f cd/m2, ambient %0.3f cd/m2\n',bgXYZ(2),ambientXYZ(2));
123+
124+
% Compute monitor primary xyY to try to understand what drifted
125+
primaryXYZ = PrimaryToSensor(calObjXYZ,[[1 0 0]' [0 1 0]' [0 0 1]']);
126+
primaryxyY = XYZToxyY(primaryXYZ);
127+
fprintf('\nRed primary xyY: %0.4f, %0.4f, %0.2f cd/m2\n',primaryxyY(1,1),primaryxyY(2,1),primaryxyY(3,1));
128+
fprintf('Green primary xyY: %0.4f, %0.4f, %0.2f cd/m2\n',primaryxyY(1,2),primaryxyY(2,2),primaryxyY(3,2));
129+
fprintf('Blue primary xyY: %0.4f, %0.4f, %0.2f cd/m2\n',primaryxyY(1,3),primaryxyY(2,3),primaryxyY(3,3));
130+
fprintf('\n');
107131

108132
%% Max contrast
109133
%

0 commit comments

Comments
 (0)