Skip to content

Commit 751fa58

Browse files
committed
More or less finish stimulus analysis code
1 parent e3eaae1 commit 751fa58

File tree

1 file changed

+58
-19
lines changed

1 file changed

+58
-19
lines changed

code/analysis/monitorGamutInLSPlane/makeMonitorGamutFigure.m

Lines changed: 58 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
% Was used with 1024 levels, but hardware is 8-bit.
1414
whichCalFile = 'ViewSonicG220fb.mat';
1515
whichCalNumber = 1;
16-
nDeviceBits = 8;
16+
nDeviceBits = 10;
1717
whichCones = 'ss2';
1818
NOAMBIENT = false;
1919
case 'detection'
@@ -329,7 +329,7 @@
329329
switch (whichExperiment)
330330
case 'tracking'
331331
contrastLim = 1.0;
332-
contrastDevLim = 0.06;
332+
contrastDevLim = 0.02;
333333
angleDevLim = 4;
334334
expNameCell = { 'Experiment1-Pos' 'Experiment2-Pos' ['Experiment3-' subjID '-Pos']};
335335
expContrastLMS = [];
@@ -350,8 +350,8 @@
350350
end
351351
case {'detection', 'detectionRaw'}
352352
% Options are 'MAB', 'BMC', 'KAS'
353-
contrastLim = 0.3;
354-
contrastDevLim = 0.015;
353+
contrastLim = 1.0;
354+
contrastDevLim = 0.02;
355355
angleDevLim = 2;
356356

357357
[targetContrast,targetAngleRaw] = getContrastLSD(subjID,'combined');
@@ -366,15 +366,15 @@
366366
% Don't care about length here as that is handled by the contrast
367367
% maximization code below.
368368
targetContrastDir = [cosd(targetAngle(cc,aa)) 0 sind(targetAngle(cc,aa))]';
369-
targetConeContrast(:,cc,aa) = (imageScaleFactor*targetContrast(cc,aa)*targetContrastDir);
369+
targetConeContrast(:,cc,aa) = (targetContrast(cc,aa)*targetContrastDir);
370370

371371
% Convert from cone contrast to cone excitation direction.
372372
% Don't care about length here as that is handled by the contrast
373373
% maximization code below.
374-
targetCones = (targetConeContrast(:,cc,aa).* bgCones) + bgCones;
374+
targetConeExcitations = (imageScaleFactor*targetConeContrast(:,cc,aa).* bgCones) + bgCones;
375375

376376
% Compute settings we would have used using first calibration
377-
[theSettings,badIndex] = SensorToSettings(calObjCones,targetCones);
377+
[theSettings,badIndex] = SensorToSettings(calObjCones,targetConeExcitations);
378378
if (any(badIndex))
379379
fprintf(' Out of gamut\n');
380380
end
@@ -407,8 +407,16 @@
407407
angleDeviation1(cc,aa) = obtainedAngle1(cc,aa)-targetAngle(cc,aa);
408408
contrastDeviation(cc,aa) = obtainedContrast(cc,aa) - targetContrast(cc,aa);
409409
contrastDeviation1(cc,aa) = obtainedContrast1(cc,aa) - targetContrast(cc,aa);
410-
MConeDeviation(cc,aa) = obtainedConeContrast(2,cc,aa);
411-
MConeDeviation1(cc,aa) = obtainedConeContrast1(2,cc,aa);
410+
411+
LConeTargetContrast(cc,aa) = targetConeContrast(1,cc,aa);
412+
LConeContrast1(cc,aa) = obtainedConeContrast1(1,cc,aa);
413+
LConeContrastDeviation1(cc,aa) = obtainedConeContrast1(1,cc,aa)-targetConeContrast(1,cc,aa);
414+
MConeTargetContrast(cc,aa) = targetConeContrast(2,cc,aa);
415+
MConeContrast1(cc,aa) = obtainedConeContrast1(2,cc,aa);
416+
MConeContrastDeviation1(cc,aa) = obtainedConeContrast1(2,cc,aa)-targetConeContrast(2,cc,aa);
417+
SConeTargetContrast(cc,aa) = targetConeContrast(3,cc,aa);
418+
SConeContrast1(cc,aa) = obtainedConeContrast1(3,cc,aa);
419+
SConeContrastDeviation1(cc,aa) = obtainedConeContrast1(3,cc,aa)-targetConeContrast(3,cc,aa);
412420

413421
% Report out
414422
fprintf(' Target contrasts: L cone contrast %7.3f%%, M, %7.3f%%, S %7.3f%%, angle %7.1f, vector length %0.1f%%\n', ...
@@ -429,39 +437,70 @@
429437

430438
% Diagnostic plots
431439
figure; clf;
432-
set(gcf,'Position',[10 10 800 1200]);
433-
subplot(3,2,1); hold on;
440+
set(gcf,'Position',[10 10 1500 1200]);
441+
subplot(3,4,1); hold on;
434442
plot(targetAngleRaw,targetAngleToUse,'ro','MarkerFaceColor','r','MarkerSize',10);
435443
plot([-100 100],[-100 100],'k');
436444
xlim([-100 100]); ylim([-100 100]);
437445
axis('square');
438446
xlabel('Target Angle (deg)'); ylabel('Obtained Angle (deg)');
439447
title([whichExperiment ' ' subjID ' Bits ' num2str(nDeviceBits)]);
440-
subplot(3,2,2); hold on;
448+
subplot(3,4,2); hold on;
441449
plot(100*targetContrast(:),100*targetContrastToUse(:),'ro','MarkerFaceColor','r','MarkerSize',10);
442450
plot([0 100*contrastLim],[0 100*contrastLim],'k');
443451
xlim([0 100*contrastLim]); ylim([0 100*contrastLim]);
444452
axis('square');
445453
xlabel('Target Contrast (%)'); ylabel('Obtained Contrast (%)');
446-
subplot(3,2,3); hold on;
454+
subplot(3,4,5); hold on;
447455
plot(targetAngleRaw,targetAngleToUse-targetAngleRaw,'ro','MarkerFaceColor','r','MarkerSize',10);
448456
plot([-100 100],[0 0],'k');
449457
xlim([-100 100]); ylim([-angleDevLim angleDevLim]);
450458
axis('square');
451459
xlabel('Target Angle (deg)'); ylabel('Obtained Angle Deviation (deg)');
452-
subplot(3,2,4); hold on;
460+
subplot(3,4,6); hold on;
453461
plot(100*targetContrast(:),100*targetContrastToUse(:)-100*targetContrast(:),'ro','MarkerFaceColor','r','MarkerSize',10);
454462
plot([0 100*contrastLim],[0 0],'k');
455463
xlim([0 100*contrastLim]); ylim([100*-contrastDevLim 100*contrastDevLim]);
456464
axis('square');
457465
xlabel('Target Contrast (%)'); ylabel('Obtained Contrast Deviation (%)');
458466

459-
subplot(3,2,5); hold on;
460-
plot(100*targetContrast(:),100*MConeDeviation1(:),'ro','MarkerFaceColor','r','MarkerSize',10);
461-
plot([0 100*contrastLim],[0 0],'k');
462-
xlim([0 100*contrastLim]); ylim([100*-contrastDevLim 100*contrastDevLim]);
467+
subplot(3,4,3); hold on;
468+
plot(100*LConeTargetContrast(:),100*LConeContrast1(:),'ro','MarkerFaceColor','r','MarkerSize',10);
469+
plot([-5 20],[-5 20],'k');
470+
xlim([-5 20]); ylim([-5 20]);
471+
axis('square');
472+
xlabel('L Cone Target Contrast (%)'); ylabel('L Cone Contrast(%)');
473+
subplot(3,4,7); hold on;
474+
plot(100*MConeTargetContrast(:),100*MConeContrast1(:),'ro','MarkerFaceColor','r','MarkerSize',10);
475+
plot([-5 5],[-2 2],'k');
476+
xlim([-5 5]); ylim([-2 2]);
477+
axis('square');
478+
xlabel('M Cone Target Contrast (%)'); ylabel('M Cone Contrast (%)');
479+
subplot(3,4,11); hold on;
480+
plot(100*SConeTargetContrast(:),100*SConeContrast1(:),'ro','MarkerFaceColor','r','MarkerSize',10);
481+
plot([-90 90],[-90 90],'k');
482+
xlim([-90 90]); ylim([-90 90]);
483+
axis('square');
484+
xlabel('SCone Target Contrast (%)'); ylabel('S Cone Contrast(%)');
485+
486+
subplot(3,4,4); hold on;
487+
plot(100*LConeTargetContrast(:),100*LConeContrastDeviation1(:),'ro','MarkerFaceColor','r','MarkerSize',10);
488+
plot([0 20],[0 0],'k');
489+
xlim([0 20]); ylim([-2 2]);
490+
axis('square');
491+
xlabel('L Cone Target Contrast (%)'); ylabel('L Cone Contrast Deviation (%)');
492+
subplot(3,4,8); hold on;
493+
plot(100*MConeTargetContrast(:),100*MConeContrastDeviation1(:),'ro','MarkerFaceColor','r','MarkerSize',10);
494+
plot([-5 5],[0 0],'k');
495+
xlim([-5 5]); ylim([-2 2]);
496+
axis('square');
497+
xlabel('M Cone Target Contrast (%)'); ylabel('M Cone Contrast Deviation (%)');
498+
subplot(3,4,12); hold on;
499+
plot(100*SConeTargetContrast(:),100*SConeContrastDeviation1(:),'ro','MarkerFaceColor','r','MarkerSize',10);
500+
plot([-90 90],[0 0],'k');
501+
xlim([-90 90]); ylim([-2 2]);
463502
axis('square');
464-
xlabel('Target Contrast (%)'); ylabel('M Cone Contrast (%)');
503+
xlabel('S Cone Target Contrast (%)'); ylabel('S Cone Contrast Deviation (%)');
465504

466505
% The angular deviations start to lose meaning as the contrast gets very
467506
% small

0 commit comments

Comments
 (0)