|
13 | 13 | % Was used with 1024 levels, but hardware is 8-bit. |
14 | 14 | whichCalFile = 'ViewSonicG220fb.mat'; |
15 | 15 | whichCalNumber = 1; |
16 | | - nDeviceBits = 8; |
| 16 | + nDeviceBits = 10; |
17 | 17 | whichCones = 'ss2'; |
18 | 18 | NOAMBIENT = false; |
19 | 19 | case 'detection' |
|
329 | 329 | switch (whichExperiment) |
330 | 330 | case 'tracking' |
331 | 331 | contrastLim = 1.0; |
332 | | - contrastDevLim = 0.06; |
| 332 | + contrastDevLim = 0.02; |
333 | 333 | angleDevLim = 4; |
334 | 334 | expNameCell = { 'Experiment1-Pos' 'Experiment2-Pos' ['Experiment3-' subjID '-Pos']}; |
335 | 335 | expContrastLMS = []; |
|
350 | 350 | end |
351 | 351 | case {'detection', 'detectionRaw'} |
352 | 352 | % Options are 'MAB', 'BMC', 'KAS' |
353 | | - contrastLim = 0.3; |
354 | | - contrastDevLim = 0.015; |
| 353 | + contrastLim = 1.0; |
| 354 | + contrastDevLim = 0.02; |
355 | 355 | angleDevLim = 2; |
356 | 356 |
|
357 | 357 | [targetContrast,targetAngleRaw] = getContrastLSD(subjID,'combined'); |
|
366 | 366 | % Don't care about length here as that is handled by the contrast |
367 | 367 | % maximization code below. |
368 | 368 | 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); |
370 | 370 |
|
371 | 371 | % Convert from cone contrast to cone excitation direction. |
372 | 372 | % Don't care about length here as that is handled by the contrast |
373 | 373 | % maximization code below. |
374 | | - targetCones = (targetConeContrast(:,cc,aa).* bgCones) + bgCones; |
| 374 | + targetConeExcitations = (imageScaleFactor*targetConeContrast(:,cc,aa).* bgCones) + bgCones; |
375 | 375 |
|
376 | 376 | % Compute settings we would have used using first calibration |
377 | | - [theSettings,badIndex] = SensorToSettings(calObjCones,targetCones); |
| 377 | + [theSettings,badIndex] = SensorToSettings(calObjCones,targetConeExcitations); |
378 | 378 | if (any(badIndex)) |
379 | 379 | fprintf(' Out of gamut\n'); |
380 | 380 | end |
|
407 | 407 | angleDeviation1(cc,aa) = obtainedAngle1(cc,aa)-targetAngle(cc,aa); |
408 | 408 | contrastDeviation(cc,aa) = obtainedContrast(cc,aa) - targetContrast(cc,aa); |
409 | 409 | 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); |
412 | 420 |
|
413 | 421 | % Report out |
414 | 422 | fprintf(' Target contrasts: L cone contrast %7.3f%%, M, %7.3f%%, S %7.3f%%, angle %7.1f, vector length %0.1f%%\n', ... |
|
429 | 437 |
|
430 | 438 | % Diagnostic plots |
431 | 439 | 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; |
434 | 442 | plot(targetAngleRaw,targetAngleToUse,'ro','MarkerFaceColor','r','MarkerSize',10); |
435 | 443 | plot([-100 100],[-100 100],'k'); |
436 | 444 | xlim([-100 100]); ylim([-100 100]); |
437 | 445 | axis('square'); |
438 | 446 | xlabel('Target Angle (deg)'); ylabel('Obtained Angle (deg)'); |
439 | 447 | title([whichExperiment ' ' subjID ' Bits ' num2str(nDeviceBits)]); |
440 | | -subplot(3,2,2); hold on; |
| 448 | +subplot(3,4,2); hold on; |
441 | 449 | plot(100*targetContrast(:),100*targetContrastToUse(:),'ro','MarkerFaceColor','r','MarkerSize',10); |
442 | 450 | plot([0 100*contrastLim],[0 100*contrastLim],'k'); |
443 | 451 | xlim([0 100*contrastLim]); ylim([0 100*contrastLim]); |
444 | 452 | axis('square'); |
445 | 453 | xlabel('Target Contrast (%)'); ylabel('Obtained Contrast (%)'); |
446 | | -subplot(3,2,3); hold on; |
| 454 | +subplot(3,4,5); hold on; |
447 | 455 | plot(targetAngleRaw,targetAngleToUse-targetAngleRaw,'ro','MarkerFaceColor','r','MarkerSize',10); |
448 | 456 | plot([-100 100],[0 0],'k'); |
449 | 457 | xlim([-100 100]); ylim([-angleDevLim angleDevLim]); |
450 | 458 | axis('square'); |
451 | 459 | xlabel('Target Angle (deg)'); ylabel('Obtained Angle Deviation (deg)'); |
452 | | -subplot(3,2,4); hold on; |
| 460 | +subplot(3,4,6); hold on; |
453 | 461 | plot(100*targetContrast(:),100*targetContrastToUse(:)-100*targetContrast(:),'ro','MarkerFaceColor','r','MarkerSize',10); |
454 | 462 | plot([0 100*contrastLim],[0 0],'k'); |
455 | 463 | xlim([0 100*contrastLim]); ylim([100*-contrastDevLim 100*contrastDevLim]); |
456 | 464 | axis('square'); |
457 | 465 | xlabel('Target Contrast (%)'); ylabel('Obtained Contrast Deviation (%)'); |
458 | 466 |
|
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]); |
463 | 502 | axis('square'); |
464 | | -xlabel('Target Contrast (%)'); ylabel('M Cone Contrast (%)'); |
| 503 | +xlabel('S Cone Target Contrast (%)'); ylabel('S Cone Contrast Deviation (%)'); |
465 | 504 |
|
466 | 505 | % The angular deviations start to lose meaning as the contrast gets very |
467 | 506 | % small |
|
0 commit comments