Browse Source

Initial Commit from Clemente. -MT

master
Clemente 6 years ago
commit
e8c8918890
  1. BIN
      .DS_Store
  2. 2
      .gitignore
  3. BIN
      002 After Image GUI Project/.DS_Store
  4. 521
      002 After Image GUI Project/AfIm_Exp.m
  5. 548
      002 After Image GUI Project/AfIm_Exp_Rivalry.m
  6. 459
      002 After Image GUI Project/AfIm_Exp_borrar.m
  7. 464
      002 After Image GUI Project/AfIm_Exp_borrarr.m
  8. 616
      002 After Image GUI Project/AfIm_Exp_copy.m
  9. 610
      002 After Image GUI Project/AfIm_Exp_old.m
  10. 608
      002 After Image GUI Project/AfIm_NOclock_Exp.m
  11. 552
      002 After Image GUI Project/AfIm_OneEnd_Exp.m
  12. 600
      002 After Image GUI Project/AfIm_pupil_Exp.m
  13. BIN
      002 After Image GUI Project/AppTEST copy.mlapp
  14. 91
      002 After Image GUI Project/AppTESTpackaged.prj
  15. 489
      002 After Image GUI Project/ContMatch_session.m
  16. 99
      002 After Image GUI Project/Disp_Color.m
  17. 8
      002 After Image GUI Project/Exp_Conditions.txt
  18. 303
      002 After Image GUI Project/HFP_session.m
  19. 39
      002 After Image GUI Project/LMS_to_XYZ.m
  20. BIN
      002 After Image GUI Project/Program Compiled/.DS_Store
  21. 39
      002 After Image GUI Project/Program Compiled/PackagingLog.html
  22. 32
      002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/Info.plist
  23. BIN
      002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/MacOS/setup
  24. 20
      002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/MacOS/setup.dSYM/Contents/Info.plist
  25. BIN
      002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/MacOS/setup.dSYM/Contents/Resources/DWARF/setup
  26. BIN
      002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/Resources/InstallAgent_35000_35010.zip
  27. BIN
      002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/Resources/bundle.zip
  28. BIN
      002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/Resources/en.lproj/MainMenu.nib
  29. BIN
      002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/Resources/installer.icns
  30. BIN
      002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/Resources/splash.png
  31. BIN
      002 After Image GUI Project/Program Compiled/for_redistribution_files_only/default_icon.icns
  32. 120
      002 After Image GUI Project/Program Compiled/for_redistribution_files_only/readme.txt
  33. 32
      002 After Image GUI Project/Program Compiled/for_redistribution_files_only/run_tvp_GENERATOR.sh
  34. BIN
      002 After Image GUI Project/Program Compiled/for_redistribution_files_only/splash.png
  35. 34
      002 After Image GUI Project/Program Compiled/for_redistribution_files_only/tvp_GENERATOR.app/Contents/Info.plist
  36. BIN
      002 After Image GUI Project/Program Compiled/for_redistribution_files_only/tvp_GENERATOR.app/Contents/MacOS/applauncher
  37. BIN
      002 After Image GUI Project/Program Compiled/for_redistribution_files_only/tvp_GENERATOR.app/Contents/MacOS/prelaunch
  38. BIN
      002 After Image GUI Project/Program Compiled/for_redistribution_files_only/tvp_GENERATOR.app/Contents/MacOS/tvp_GENERATOR
  39. BIN
      002 After Image GUI Project/Program Compiled/for_redistribution_files_only/tvp_GENERATOR.app/Contents/Resources/Base.lproj/About.nib
  40. BIN
      002 After Image GUI Project/Program Compiled/for_redistribution_files_only/tvp_GENERATOR.app/Contents/Resources/Base.lproj/MWOpenAccessoryView.nib
  41. BIN
      002 After Image GUI Project/Program Compiled/for_redistribution_files_only/tvp_GENERATOR.app/Contents/Resources/Base.lproj/MWSaveAccessoryView.nib
  42. BIN
      002 After Image GUI Project/Program Compiled/for_redistribution_files_only/tvp_GENERATOR.app/Contents/Resources/Base.lproj/MainMenu.nib
  43. BIN
      002 After Image GUI Project/Program Compiled/for_redistribution_files_only/tvp_GENERATOR.app/Contents/Resources/membrane.icns
  44. BIN
      002 After Image GUI Project/Program Compiled/for_testing/.DS_Store
  45. 7
      002 After Image GUI Project/Program Compiled/for_testing/mccExcludedFiles.log
  46. 120
      002 After Image GUI Project/Program Compiled/for_testing/readme.txt
  47. 1
      002 After Image GUI Project/Program Compiled/for_testing/requiredMCRProducts.txt
  48. 32
      002 After Image GUI Project/Program Compiled/for_testing/run_tvp_GENERATOR.sh
  49. BIN
      002 After Image GUI Project/Program Compiled/for_testing/splash.png
  50. 34
      002 After Image GUI Project/Program Compiled/for_testing/tvp_GENERATOR.app/Contents/Info.plist
  51. BIN
      002 After Image GUI Project/Program Compiled/for_testing/tvp_GENERATOR.app/Contents/MacOS/applauncher
  52. BIN
      002 After Image GUI Project/Program Compiled/for_testing/tvp_GENERATOR.app/Contents/MacOS/prelaunch
  53. BIN
      002 After Image GUI Project/Program Compiled/for_testing/tvp_GENERATOR.app/Contents/MacOS/tvp_GENERATOR
  54. BIN
      002 After Image GUI Project/Program Compiled/for_testing/tvp_GENERATOR.app/Contents/Resources/Base.lproj/About.nib
  55. BIN
      002 After Image GUI Project/Program Compiled/for_testing/tvp_GENERATOR.app/Contents/Resources/Base.lproj/MWOpenAccessoryView.nib
  56. BIN
      002 After Image GUI Project/Program Compiled/for_testing/tvp_GENERATOR.app/Contents/Resources/Base.lproj/MWSaveAccessoryView.nib
  57. BIN
      002 After Image GUI Project/Program Compiled/for_testing/tvp_GENERATOR.app/Contents/Resources/Base.lproj/MainMenu.nib
  58. BIN
      002 After Image GUI Project/Program Compiled/for_testing/tvp_GENERATOR.app/Contents/Resources/membrane.icns
  59. 5
      002 After Image GUI Project/Prueba_ReadTable.txt
  60. 120
      002 After Image GUI Project/TRY_NonCardPULSE.m
  61. BIN
      002 After Image GUI Project/TVP_GENERATOR.mlapp
  62. BIN
      002 After Image GUI Project/TVP_GENERATOR.mlappinstall
  63. BIN
      002 After Image GUI Project/TVP_GENERATOR_resources/.DS_Store
  64. BIN
      002 After Image GUI Project/TVP_GENERATOR_resources/icon_16.png
  65. BIN
      002 After Image GUI Project/TVP_GENERATOR_resources/icon_24.png
  66. BIN
      002 After Image GUI Project/TVP_GENERATOR_resources/icon_48.png
  67. 343
      002 After Image GUI Project/Visu_Stim_Gen.prj
  68. 0
      002 After Image GUI Project/XX_SessionsInfo
  69. 73
      002 After Image GUI Project/XYZ_to_RGB.m
  70. BIN
      002 After Image GUI Project/colorCalFile1.mat
  71. 13
      002 After Image GUI Project/flatSound.m
  72. 15
      002 After Image GUI Project/pruebaFuncion.m
  73. 37
      002 After Image GUI Project/pruebaReadTable.m
  74. 9
      002 After Image GUI Project/sinspace.m
  75. 9
      002 After Image GUI Project/sinspaceOneCycle.m
  76. 268
      002 After Image GUI Project/tvp_GENERATOR.prj
  77. BIN
      Experimental Conditions (zaidi paradigm)/.DS_Store
  78. 2
      Experimental Conditions (zaidi paradigm)/01 Backgr_EEW_9axes_4cont.txt
  79. 14
      Experimental Conditions (zaidi paradigm)/MT_9_CHROS_lum.txt
  80. 11
      Experimental Conditions (zaidi paradigm)/OneEnd_4_CHROS_3axis.txt
  81. 10
      Experimental Conditions (zaidi paradigm)/OneEnd_5_CHROS_3axis.txt
  82. BIN
      Experimental Conditions (zaidi paradigm)/Others/.DS_Store
  83. 2
      Experimental Conditions (zaidi paradigm)/Others/01 Backgr_EEW_9axes_4cont.txt
  84. 5
      Experimental Conditions (zaidi paradigm)/Others/02 Backgr_4chro_9axes_2cont.txt
  85. 11
      Experimental Conditions (zaidi paradigm)/Others/MT_OneEnd_4_CHROS_3axis.txt
  86. 10
      Experimental Conditions (zaidi paradigm)/Others/MT_OneEnd_5_CHROS_3axis.txt
  87. 5
      Experimental Conditions (zaidi paradigm)/Others/Prueba_ReadTable.txt
  88. 6
      Experimental Conditions (zaidi paradigm)/Others/TEST01 Backgr_5chro_9axes_1cont.txt
  89. 19
      Experimental Conditions (zaidi paradigm)/Others/TESTING 13_CHROS_1axis.txt
  90. 19
      Experimental Conditions (zaidi paradigm)/Others/TESTING 13_CHROS_2axes.txt
  91. 5
      Experimental Conditions (zaidi paradigm)/Others/TESTING ClosestEEW-Chro ColorBackgr.txt
  92. 6
      Experimental Conditions (zaidi paradigm)/Others/TESTING Middle-Chro ColorBackgr.txt
  93. 6
      Experimental Conditions (zaidi paradigm)/Others/TESTING MostExtreme-Chro ColorBackgr.txt
  94. 19
      Experimental Conditions (zaidi paradigm)/Others/TESTING_OneEnd_13_CHROS_1axis.txt
  95. 14
      Experimental Conditions (zaidi paradigm)/Others/TESTING_OneEnd_7_CHROS_1axis(1).txt
  96. 14
      Experimental Conditions (zaidi paradigm)/Others/TESTING_OneEnd_7_CHROS_1axis(2).txt
  97. 9
      Experimental Conditions (zaidi paradigm)/Others/TESTT copy.txt
  98. 9
      Experimental Conditions (zaidi paradigm)/Others/TESTT.txt
  99. 13
      Experimental Conditions (zaidi paradigm)/Others/TEST_Chros_OtherContrasts.txt
  100. 9
      Experimental Conditions (zaidi paradigm)/Others/TEST_lAxis_Contrast.txt
  101. Some files were not shown because too many files have changed in this diff Show More

BIN
.DS_Store vendored

Binary file not shown.

2
.gitignore vendored

@ -0,0 +1,2 @@
/A\ Outputs/
.DS_STORE/

BIN
002 After Image GUI Project/.DS_Store vendored

Binary file not shown.

521
002 After Image GUI Project/AfIm_Exp.m

@ -0,0 +1,521 @@
function AfIm_Exp(subName,meanLum,Bckg_Chro,axis_chck,AdaptTime,nRep,Simu_chck)
try
assignin('base','Stop_Press',0)% this works for the STOP experiment button
% Check that Psychtoolbox is properly installed, switch to unified KbName's
% across operating systems, and switch color range to normalized 0 - 1 range:
PsychDefaultSetup(2);
saveFile = sprintf('%s_afterimage', subName)
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
fp = fopen(saveFile, 'at');
%% Color information, load hfp data and color calibration
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
hfpFile = sprintf('%sHFP', subName);
load(hfpFile, '-mat')
hfpRG = rg_avg;
hfpBG = bg_avg;
% cd(a); % return to program folder.
Calib_Dire = cd('/Users/clemente/Desktop/AfterImage Programs/002 After Image GUI Project');
load colorCalFile1.mat
fprintf('\nLast calibration was %s\n', describe.date)
pix = pix/1001;
cd(aa) ;% output folder
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
% aa = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\A Outputs')
% maxLum = 20; %cd/m^2
contFile = sprintf('%s_ContMatch', subName);
cd
load(contFile, '-mat')
% % % % lCont = fliplr(Final_lCont_avg);% sort the matrix in descendent order
% % % % lumMod = fliplr(Final_lumMod_avg);
% % % %
% % % % sCont = [.8 .65 .5 .35];
% % % % nCont = 4;
% lCont = Final_lCont_avg(:,4:5);
% lumMod = Final_lumMod_avg(:,4:5);
% sCont = [.5 .65
% .5 .65
% .5 .65
% .5 .65];
%
% nCont = 2;
% lCont = Final_lCont_avg(3:6);
% lumMod = Final_lumMod_avg(3:6);
% sCont = [.5 .65
% .5 .65
% .5 .65
% .5 .65];
% sCont = Final_sCont_ref;
lCont = Final_lCont_avg;
lumMod = Final_lumMod_avg;
sCont = Final_sCont_ref;
nCont = size(sCont,2);
nBckg_Chro = size(Bckg_Chro,1);
% white = [.665 1];
blackLut = [0 0 0];
redLut = [.8 0 0];
% Bckg_Chro = Final_lCont_avg(:,1:2)
%% Save Session Information
theDate = fix(clock);
% a = '/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/4 ColBackg AI' ;% folder where the program is.
infoFile = sprintf('%s_SessionsInfo', subName)
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs'); ;% folder where the program is.
checkfile = exist(infoFile, 'file')
fo = fopen(infoFile, 'at')
if checkfile == 0 % if file doesn't exist, then print the following header:
fprintf(fo,'Subject\t Date\t Time\t Lum\t nBckg_Chro\t nCont\t nRep\t l_\t s_\t lum_\t ls45\t ls135\t luml45\t luml135\t lums45\t luml135\n')
end
% fo = fopen(infoFile, 'at')
fprintf(fo, '%s\t%i/%i/%i %i:%i:%i\t %1.2f\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\n',...
subName, theDate(2), theDate(3), theDate(1), theDate(4), theDate(5), round(theDate(6)),...
meanLum, nBckg_Chro, nCont, nRep,axis_chck(1),axis_chck(2),...
axis_chck(3),axis_chck(4) ,axis_chck(5),axis_chck(6),...
axis_chck(7),axis_chck(8),axis_chck(9));
% % % % fprintf(fo, '%s\t%i/%i/%i %i:%i:%i\t %1.2f\t%1.3f\t%1.3f\t%i\n',...
% % % % subName, theDate(2), theDate(3), theDate(1), theDate(4), theDate(5), round(theDate(6)),...
% % % % maxLum, white(1),white(2), nRep)%,curr_cond(1),curr_cond(2),...
% % % % % % curr_cond(3),curr_cond(4) ,curr_cond(5),curr_cond(6),...
% % % % % % curr_cond(7),curr_cond(8),curr_cond(9));
fclose(fo)
%% set up psych toolbox
%set up 10 bit color
PsychImaging('PrepareConfiguration');
%PsychImaging('AddTask', 'General', 'EnableNative10BitFrameBuffer',1); %the 0 is turn off dithering?
expScreen = 1;
%create white LUT
% cd(a);
% % % wLMS(1,1) = white(1,1)*maxLum;
% % % wLMS(1,2) = (1-white(1,1))*maxLum;
% % % wLMS(1,3) = white(1,2)*maxLum;
% % % wXYZ(1,:) = LMS_to_XYZ(wLMS(1,:));
% % % wRGB(1,:) = XYZ_to_RGB(wXYZ(1,:), maxPhosXYZ);
% % % wRGB(1,1) = pix(dsearchn(redProp(:), wRGB(1,1)))*hfpRG;
% % % wRGB(1,2) = pix(dsearchn(grnProp(:), wRGB(1,2)));
% % % wRGB(1,3) = pix(dsearchn(blueProp(:), wRGB(1,3)))*hfpBG;
[window, windowRect] = PsychImaging('OpenWindow', expScreen, [0 0 0], [], [], []); % Set a black screen before starting
%Screen('OpenWindow',0, [0 0 0]); %makes main screen dark
%PsychImaging('OpenWindow', expScreen, wRGB);
[xcent,ycent] = RectCenter(windowRect);
center = [xcent ycent];
%% TIMING
%find frames per second
ifi = Screen('GetFlipInterval', window);% Measure the vertical refresh rate of the monitor
topPriorityLevel = MaxPriority(window);% Retreive the maximum priority number
numSecs = 16; %in seconds, total presentation time
framesPerSec = round(1/ifi);
nFrames = numSecs * framesPerSec;
waitframes = 1; %number of frames to wait between refresh
% color changed .03 of full cycle per second - finished 1/2 cycle in 16 seconds, 1/32
%in Zaidi, clock face appears at 10.15 seconds, will approximate this
%number
zaidiClock = 10.15; %is when Zaidi started in his example.
clFrmStart = floor(1/ifi*zaidiClock);
clTotTime = 2.9*2; %how long is clock in the screen
handInt = 12*2; %how many places to stop around the clock
clFrames = floor(clTotTime/handInt/ifi); %this will move the hand 15 degrees at a time, and decides how many frames to sit at each angle
%% Stimulus Size Parameters
circleDeg = 3.6;
clockPt = 0.1;
% code assumes 1 pixel = 1 arc min
pixPerDeg = 35; %at a distance of 57 cm
circlePix = circleDeg*pixPerDeg;
clockPix = clockPt*pixPerDeg;
tstcircle = [xcent - circlePix/2 ycent - circlePix/2 xcent + circlePix/2 ycent + circlePix/2];
%create circular grid for clock face and the numbers
% % % circleDegGrid = 2 ;
% % % rad = circleDegGrid/2*pixPerDeg; %circlePix/2-pixPerDeg/2;
rad = circleDeg/2*pixPerDeg; %circlePix/2-pixPerDeg/2;
radNum = (circleDeg/2) * pixPerDeg;
clockDegs = [1:15:360];
for iC = 1:length(clockDegs)
[xcFace(iC), ycFace(iC)] = pol2cart(clockDegs(iC)*pi/180, rad);
[xcNumber(iC), ycNumber(iC)] = pol2cart(clockDegs(iC)*pi/180, 1*radNum);
end
%create matrix of dot locations
clockPosMat = [reshape(xcFace,1, length(clockDegs)); reshape(ycFace,1, length(clockDegs))];
clockNumMat = [reshape(xcNumber,1, length(clockDegs)); reshape(ycNumber,1, length(clockDegs))];
Screen('TextSize', window, 14);
textOne = [6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 2 3 4 5];
yPositionIsBaseline=1;
%create array of second hand positions to index
count = 1;
secHandCord(1:handInt) = (1:15:360)*(pi/180);
for iMove = 1:length(secHandCord)
secHandMove(count:count+clFrames-1) = secHandCord(iMove);
count = count+clFrames;
end
secHandMove(length(secHandMove)+1:length(secHandMove)*2) = secHandMove(1:length(secHandMove));
WaitSecs(1);
%%/////////////////////////////////////////////////////////////////////////
%%///////////////////////// EXPERIMENT TRIALS /////////////////////////////
%%/////////////////////////////////////////////////////////////////////////
clear iCond
curr_axis = find(axis_chck)
TrialCount = 1;
%run experiment
TrialCount = 1;
Card_Dir = 0;
for iChro = 1:size(Bckg_Chro,1)
wLMS(1,1) = Bckg_Chro(iChro,1)*meanLum;
wLMS(1,2) = (1-Bckg_Chro(iChro,1))*meanLum;
wLMS(1,3) = Bckg_Chro(iChro,2)*meanLum;
wXYZ(1,:) = LMS_to_XYZ(wLMS(1,:));
wRGB(1,:) = XYZ_to_RGB(wXYZ(1,:), maxPhosXYZ);
wRGB(1,1) = pix(dsearchn(redProp(:), wRGB(1,1)))*hfpRG;
wRGB(1,2) = pix(dsearchn(grnProp(:), wRGB(1,2)));
wRGB(1,3) = pix(dsearchn(blueProp(:), wRGB(1,3)))*hfpBG;
commandwindow;
Speak(' Press any key when you are ready');
KbStrokeWait;
Screen('FillRect', window, wRGB);
Screen('Flip',window)
WaitSecs(AdaptTime)
for iRep = 1:nRep
cont = randperm(nCont); %randomize contrast conditions
for iCont = 1:nCont
FlushEvents('mouseDown','keyDown');
%create colors with depending on contrast
l = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum]; %+l, -l
s = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum];%+s, -s
lum = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2) meanLum-lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2) meanLum+lumMod(iChro,cont(iCont))]; % -lum , +lum
l_s_45 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum];
l_s_135 = [Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum
Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum];
lum_l_45 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum+lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum-lumMod(iChro,cont(iCont))];
lum_l_135 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum-lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum+lumMod(iChro,cont(iCont))];
lum_s_45 = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum+lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum-lumMod(iChro,cont(iCont))];
lum_s_135 = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum-lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum+lumMod(iChro,cont(iCont))];
rnd_idx = randperm(length(curr_axis));
curr_axis = curr_axis(rnd_idx)
% cond = randperm(9);
for iCond = 1:length(curr_axis)
%create table of color changes
switch curr_axis(iCond)
case 1
colLut = l;
case 2
colLut = s;
case 3 %%%% ATENCION que ahora LUM es la condicion 3
colLut = lum;
case 4
colLut = l_s_45;
case 5
colLut = l_s_135;
case 6
colLut = lum_l_45;
case 7
colLut = lum_l_135;
case 8
colLut = lum_s_45;
case 9
colLut = lum_s_135;
end
%LMS values of each color, ls to LMS
for iLMS = 1:2
cLMS(iLMS,1) = colLut(iLMS,1)*colLut(iLMS, 3);
cLMS(iLMS,2) = (1-colLut(iLMS,1))*colLut(iLMS, 3);
cLMS(iLMS,3) = colLut(iLMS,2)*colLut(iLMS, 3);
end
%XYZ values for each
for iXYZ = 1:length(cLMS(:,1))
cXYZ(iXYZ,:) = LMS_to_XYZ(cLMS(iXYZ,:));
end
%use lut to find corrected monitor RGB values for each rgb color
for iRGB = 1:length(cXYZ(:,1))
cRGB(iRGB,:) = XYZ_to_RGB(cXYZ(iRGB,:), maxPhosXYZ);
cRGB(iRGB,1) = pix(dsearchn(redProp(:), cRGB(iRGB,1)))*hfpRG;
cRGB(iRGB,2) = pix(dsearchn(grnProp(:), cRGB(iRGB,2)));
cRGB(iRGB,3) = pix(dsearchn(blueProp(:), cRGB(iRGB,3)))*hfpBG;
end
rampLeft = zeros(nFrames,3);
rampRight = zeros(nFrames,3);
for iRamp = 1:3 %for 3 phosophors
rampLeft(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(1,iRamp), nFrames);
rampRight(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(2,iRamp), nFrames);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% loadCombined =1;
% if loadCombined
% rampLeft = importdata('rampLeft_Combined.mat');
% rampRight = importdata('rampRight_Combined.mat');
% end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%create random start point for clock hand
randStrt = randi(handInt-1); %won't pick midnight as start point due to second hand array not being long enough
%clock set to go around 1 full circle
for ihand = 1:handInt*clFrames+clFrames
th(ihand) = (secHandMove(randStrt*clFrames-clFrames+ihand));
[handx(ihand), handy(ihand)] = pol2cart(th(ihand),1*rad);
end
handx = handx + xcent;
handy = handy + ycent;
WaitSecs(5); %a short adaptation before the next trial
keypress = 0;
count = 0; %for clock hand
TrialCountStr = num2str(TrialCount);
Priority(topPriorityLevel);
FlushEvents('mouseDown','keyDown');
%ListenChar(2)
secs0 = Screen('Flip', window);
for iFrames = 1:nFrames
Screen('FillArc', window, rampLeft(iFrames,:), tstcircle, 0, 180);
Screen('FillArc', window, rampRight(iFrames,:), tstcircle, 180, 180);
Screen('DrawDots', window, clockPosMat,clockPix, blackLut, center, 2);
Screen('DrawDots', window, [0 0],clockPix, 0, center, 2); % black dot for fixation
Screen('DrawText', window, TrialCountStr, 20, 20, redLut, wRGB);
for itxt = 1:24
textNum = sprintf('%i', textOne(itxt));
Screen('DrawText', window, textNum, 1.18*clockNumMat(1,itxt)+center(1,1)-7, 1.18*clockNumMat(2,itxt)+center(1,2)-7, blackLut, wRGB);
end
if iFrames == clFrmStart
beep;
end
if iFrames > clFrmStart-1 && iFrames < clFrmStart + handInt*clFrames+5
count = count+1;
Screen('DrawLine', window, redLut, xcent, ycent, handx(count), handy(count), 2.5);
end
% % %-----------------
% % % PrintScreen of the monitor (for the paper)
% % % GetImage call. Alter the rect argument to change the location of the screen shot
% % imageArray = Screen('GetImage', window, [0 0 300 300]);
% % % imwrite is a Matlab function, not a PTB-3 function
% % imwrite(imageArray, 'test.jpg')
% % %------------------
vbl = Screen('Flip', window, secs0 + (waitframes - 0.5) * ifi);
Screen('DrawingFinished', window); % tell psychtoolbox drawing is finished, should help timing
end
Priority(0);
% % % % while ~keypress
% % % % if CharAvail
% % % % userRes = input(' ');
% % % % keypress = 1;
% % % % end
% % % % end
% % % % FlushEvents('mouseDown','keyDown');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% RESPONSES %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if Simu_chck
userRes = 'simu';
else
keyIsDown=0;
kbName=[];
Digit = [];
Nums = {'0','1','2','3','4','5','6','7','8','9'};
Screen('TextSize', window, 30);
commandwindow;
while keyIsDown==0 | (strcmp('ENTER',kbName)==0)% & strcmp('2',kbName)==0)
keyIsDown=0;
[keyIsDown, secs, keyCode] = KbCheck;
if keyIsDown==1 %
kbName = KbName(keyCode);
end
if Digit & any(strcmp(Nums(:),kbName));
idx=find(strcmp(Nums(:),kbName));
NumPressed = Nums{idx};
kbName = strcat(firstDigit,NumPressed);
userRes = kbName;
% DrawFormattedText(window, kbName, 'center', 'center', color);
DrawFormattedText(window, kbName, 400, 512, redLut);
Screen('Flip', window);
kbName = [];
Digit = 0;
WaitSecs(.4);
elseif any(strcmp(Nums(:),kbName))
idx=find(strcmp(Nums(:),kbName));
NumPressed = Nums{idx};
userRes = kbName;
%-si es numero -- llevarlo a la pantalla
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
Digit = 1 ;% flag to mean that
firstDigit = kbName;
WaitSecs(.4);
kbName = [];
end
if strcmp('DELETE',kbName)==1 %-si es el backspace --limpiar numero
kbName = []% ;
userRes = kbName
firstDigit = [];
Digit = 0;
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
%else % -si no es numero -- ignorar
WaitSecs(.4);
end
end %end while
end
% userRes = num2str(2);
AfterResp = 'OK'
Screen('TextSize', window, 14);
FlushEvents('mouseDown','keyDown');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SAVE %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
% aa = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\A Outputs')
cd
WaitSecs(.2)
time = clock;
fprintf(fp, '%s\t%i/%i/%i %i:%i:%i\t%1.3f\t%1.3f\t%1.3f\t%1.3f\t%i\t%i\t%i\t%i\t%s\tExperiment\n',...
subName, time(2), time(3), time(1), time(4), time(5), round(time(6)), hfpRG, hfpBG, Bckg_Chro(iChro,1), Bckg_Chro(iChro,2), cont(iCont), curr_axis(iCond), Card_Dir, randStrt+5, userRes);
% a = cd('/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/4 ColBackg AI'); %
% a = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\4 AfterImage'); %
cd
WaitSecs(.2)
%ListenChar(0)
Screen('FillRect', window, wRGB, windowRect);
Screen('Flip', window);
clear secHandCord colLut
TrialCount = TrialCount+1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% WANT TO STOP? %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% pause(3)
yesno=evalin('base','Stop_Press')
if yesno==1
return
end
end %ICond
end %iCont
end %iRep
end %iChro
fclose(fp);
sca
%create a matrix of seconds compared to pi values for each frame - just
%used in data analysis
% % % % piVSsecs(:,1) = [0:1/(nFrames-1):1];
% % % % piVSsecs(:,2) = [0:numSecs/(nFrames-1):numSecs];
catch
warndlg('The program failed to run. Try again.')
return
end
end

548
002 After Image GUI Project/AfIm_Exp_Rivalry.m

@ -0,0 +1,548 @@
function AfIm_Exp_Rivalry(subName,meanLum,Bckg_Chro,axis_chck,AdaptTime,nRep,Simu_chck)
try
assignin('base','Stop_Press',0)% this works for the STOP experiment button
% Check that Psychtoolbox is properly installed, switch to unified KbName's
% across operating systems, and switch color range to normalized 0 - 1 range:
PsychDefaultSetup(2);
saveFile = sprintf('%s_afterimage', subName)
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
fp = fopen(saveFile, 'at');
%% Color information, load hfp data and color calibration
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
hfpFile = sprintf('%sHFP', subName);
load(hfpFile, '-mat')
hfpRG = rg_avg;
hfpBG = bg_avg;
% cd(a); % return to program folder.
Calib_Dire = cd('/Users/clemente/Desktop/AfterImage Programs/002 After Image GUI Project');
load colorCalFile1.mat
fprintf('\nLast calibration was %s\n', describe.date)
pix = pix/1001;
cd(aa) ;% output folder
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
% aa = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\A Outputs')
% maxLum = 20; %cd/m^2
contFile = sprintf('%s_ContMatch', subName);
cd
load(contFile, '-mat')
% % % % lCont = fliplr(Final_lCont_avg);% sort the matrix in descendent order
% % % % lumMod = fliplr(Final_lumMod_avg);
% % % %
% % % % sCont = [.8 .65 .5 .35];
% % % % nCont = 4;
% lCont = Final_lCont_avg(:,4:5);
% lumMod = Final_lumMod_avg(:,4:5);
% sCont = [.5 .65
% .5 .65
% .5 .65
% .5 .65];
%
% nCont = 2;
% lCont = Final_lCont_avg(3:6);
% lumMod = Final_lumMod_avg(3:6);
% sCont = [.5 .65
% .5 .65
% .5 .65
% .5 .65];
% sCont = Final_sCont_ref;
lCont = Final_lCont_avg;
lumMod = Final_lumMod_avg;
sCont = Final_sCont_ref;
nCont = size(sCont,2);
nBckg_Chro = size(Bckg_Chro,1);
% white = [.665 1];
blackLut = [0 0 0];
redLut = [.8 0 0];
% Bckg_Chro = Final_lCont_avg(:,1:2)
%% Save Session Information
theDate = datestr(now(),'mm/dd/yyyy HH:MM:SS')
% a = '/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/4 ColBackg AI' ;% folder where the program is.
infoFile = sprintf('%s_SessionsInfo', subName)
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs'); ;% folder where the program is.
checkfile = exist(infoFile, 'file')
fo = fopen(infoFile, 'at')
if checkfile == 0 % if file doesn't exist, then print the following header:
fprintf(fo,'Subject\t Date\t Time\t Lum\t nBckg_Chro\t nCont\t nRep\t l_\t s_\t lum_\t ls45\t ls135\t luml45\t luml135\t lums45\t luml135\n')
end
% fo = fopen(infoFile, 'at')
fprintf(fo, '%s\t%s\t %1.2f\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n',...
subName, theDate, meanLum, nBckg_Chro, nCont, nRep, axis_chck);
% % % % fprintf(fo, '%s\t%i/%i/%i %i:%i:%i\t %1.2f\t%1.3f\t%1.3f\t%i\n',...
% % % % subName, theDate(2), theDate(3), theDate(1), theDate(4), theDate(5), round(theDate(6)),...
% % % % maxLum, white(1),white(2), nRep)%,curr_cond(1),curr_cond(2),...
% % % % % % curr_cond(3),curr_cond(4) ,curr_cond(5),curr_cond(6),...
% % % % % % curr_cond(7),curr_cond(8),curr_cond(9));
fclose(fo)
%% set up psych toolbox
%set up 10 bit color
PsychImaging('PrepareConfiguration');
%PsychImaging('AddTask', 'General', 'EnableNative10BitFrameBuffer',1); %the 0 is turn off dithering?
expScreen = 1;
%create white LUT
% cd(a);
% % % wLMS(1,1) = white(1,1)*maxLum;
% % % wLMS(1,2) = (1-white(1,1))*maxLum;
% % % wLMS(1,3) = white(1,2)*maxLum;
% % % wXYZ(1,:) = LMS_to_XYZ(wLMS(1,:));
% % % wRGB(1,:) = XYZ_to_RGB(wXYZ(1,:), maxPhosXYZ);
% % % wRGB(1,1) = pix(dsearchn(redProp(:), wRGB(1,1)))*hfpRG;
% % % wRGB(1,2) = pix(dsearchn(grnProp(:), wRGB(1,2)));
% % % wRGB(1,3) = pix(dsearchn(blueProp(:), wRGB(1,3)))*hfpBG;
[window, windowRect] = PsychImaging('OpenWindow', expScreen, [0 0 0], [], [], []); % Set a black screen before starting
%Screen('OpenWindow',0, [0 0 0]); %makes main screen dark
%PsychImaging('OpenWindow', expScreen, wRGB);
[xcent,ycent] = RectCenter(windowRect);
center = [xcent ycent];
[xWinSize,~] = Screen('WindowSize',window);
%% TIMING
%find frames per second
ifi = Screen('GetFlipInterval', window);% Measure the vertical refresh rate of the monitor
topPriorityLevel = MaxPriority(window);% Retreive the maximum priority number
numSecs = 16; %in seconds, total presentation time
framesPerSec = round(1/ifi);
nFrames = numSecs * framesPerSec;
waitframes = 1; %number of frames to wait between refresh
% color changed .03 of full cycle per second - finished 1/2 cycle in 16 seconds, 1/32
%in Zaidi, clock face appears at 10.15 seconds, will approximate this
%number
zaidiClock = 10.15; %is when Zaidi started in his example.
clFrmStart = floor(1/ifi*zaidiClock);
clTotTime = 2.9*2; %how long is clock in the screen
handInt = 12*2; %how many places to stop around the clock
clFrames = floor(clTotTime/handInt/ifi); %this will move the hand 15 degrees at a time, and decides how many frames to sit at each angle
%% Stimulus Size Parameters
circleDeg = 3.6;
clockPt = 0.1;
% code assumes 1 pixel = 1 arc min
pixPerDeg = 35; %at a distance of 57 cm
circlePix = circleDeg*pixPerDeg;
clockPix = clockPt*pixPerDeg;
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%% CIRCLE HALf LOCATIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%tstcircle = [xcent - circlePix/2 ycent - circlePix/2 xcent + circlePix/2 ycent + circlePix/2];
rhtXCircleCenter = xWinSize/4;
lftXCircleCenter = xWinSize-xWinSize/4;
tstCircleLeft = [lftXCircleCenter - circlePix/2 ycent - circlePix/2 lftXCircleCenter + circlePix/2 ycent + circlePix/2];
tstCircleRight = [rhtXCircleCenter - circlePix/2 ycent - circlePix/2 rhtXCircleCenter + circlePix/2 ycent + circlePix/2];
%create circular grid for clock face and the numbers
% % % circleDegGrid = 2 ;
% % % rad = circleDegGrid/2*pixPerDeg; %circlePix/2-pixPerDeg/2;
rad = circleDeg/2*pixPerDeg; %circlePix/2-pixPerDeg/2;
radNum = (circleDeg/2) * pixPerDeg;
degreeNumbers = linspace(0,360,25);
clockDegs = degreeNumbers(1:end-1); %[1:15:360];
clockDegsLft = [90:15:269];
clockDegsRht = [270:15:359,0:15:89];
for iC = 1:length(clockDegs)
[xcFace(iC), ycFace(iC)] = pol2cart(clockDegs(iC)*pi/180, rad);
[xcNumber(iC), ycNumber(iC)] = pol2cart(clockDegs(iC)*pi/180, 1*radNum);
end
for iC = 1:length(clockDegsLft)
[xcRhtFace(iC), ycRhtFace(iC)] = pol2cart(clockDegsLft(iC)*pi/180, rad);
[xcRhtNumber(iC), ycRhtNumber(iC)] = pol2cart(clockDegsLft(iC)*pi/180, 1*radNum);
end
for iC = 1:length(clockDegsRht)
[xcLftFace(iC), ycLftFace(iC)] = pol2cart(clockDegsRht(iC)*pi/180, rad);
[xcLftNumber(iC), ycLftNumber(iC)] = pol2cart(clockDegsRht(iC)*pi/180, 1*radNum);
end
%create matrix of dot locations
clockPosMat = [reshape(xcFace,1, length(clockDegs)); reshape(ycFace,1, length(clockDegs))];
clockNumMat = [reshape(xcNumber,1, length(clockDegs)); reshape(ycNumber,1, length(clockDegs))];
clockRhtPosMat = [reshape(xcRhtFace,1, length(clockDegsRht)); reshape(ycRhtFace,1, length(clockDegsRht))];
clockRhtNumMat = [reshape(xcRhtNumber,1, length(clockDegsRht)); reshape(ycRhtNumber,1, length(clockDegsRht))];
clockLftPosMat = [reshape(xcLftFace,1, length(clockDegsLft)); reshape(ycLftFace,1, length(clockDegsLft))];
clockLftNumMat = [reshape(xcLftNumber,1, length(clockDegsLft)); reshape(ycLftNumber,1, length(clockDegsLft))];
Screen('TextSize', window, 14);
textOne = [12:24,1:11]; %[6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 2 3 4 5];
yPositionIsBaseline=1;
%create array of second hand positions to index
count = 1;
secHandCord(1:handInt) = (1:15:360)*(pi/180);
for iMove = 1:length(secHandCord)
secHandMove(count:count+clFrames-1) = secHandCord(iMove);
count = count+clFrames;
end
secHandMove(length(secHandMove)+1:length(secHandMove)*2) = secHandMove(1:length(secHandMove));
WaitSecs(1);
%%/////////////////////////////////////////////////////////////////////////
%%///////////////////////// EXPERIMENT TRIALS /////////////////////////////
%%/////////////////////////////////////////////////////////////////////////
clear iCond
curr_axis = find(axis_chck)
TrialCount = 1;
%run experiment
TrialCount = 1;
Card_Dir = 0;
for iChro = 1:size(Bckg_Chro,1)
wLMS(1,1) = Bckg_Chro(iChro,1)*meanLum;
wLMS(1,2) = (1-Bckg_Chro(iChro,1))*meanLum;
wLMS(1,3) = Bckg_Chro(iChro,2)*meanLum;
wXYZ(1,:) = LMS_to_XYZ(wLMS(1,:));
wRGB(1,:) = XYZ_to_RGB(wXYZ(1,:), maxPhosXYZ);
wRGB(1,1) = pix(dsearchn(redProp(:), wRGB(1,1)))*hfpRG;
wRGB(1,2) = pix(dsearchn(grnProp(:), wRGB(1,2)));
wRGB(1,3) = pix(dsearchn(blueProp(:), wRGB(1,3)))*hfpBG;
commandwindow;
Speak(' Press any key when you are ready');
KbStrokeWait;
Screen('FillRect', window, wRGB);
Screen('Flip',window)
WaitSecs(AdaptTime)
for iRep = 1:nRep
cont = randperm(nCont); %randomize contrast conditions
for iCont = 1:nCont
FlushEvents('mouseDown','keyDown');
%create colors with depending on contrast
l = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum]; %+l, -l
s = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum];%+s, -s
lum = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2) meanLum-lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2) meanLum+lumMod(iChro,cont(iCont))]; % -lum , +lum
l_s_45 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum];
l_s_135 = [Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum
Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum];
lum_l_45 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum+lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum-lumMod(iChro,cont(iCont))];
lum_l_135 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum-lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum+lumMod(iChro,cont(iCont))];
lum_s_45 = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum+lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum-lumMod(iChro,cont(iCont))];
lum_s_135 = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum-lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum+lumMod(iChro,cont(iCont))];
rnd_idx = randperm(length(curr_axis));
curr_axis = curr_axis(rnd_idx)
% cond = randperm(9);
for iCond = 1:length(curr_axis)
%create table of color changes
switch curr_axis(iCond)
case 1
colLut = l;
case 2
colLut = s;
case 3 %%%% ATENCION que ahora LUM es la condicion 3
colLut = lum;
case 4
colLut = l_s_45;
case 5
colLut = l_s_135;
case 6
colLut = lum_l_45;
case 7
colLut = lum_l_135;
case 8
colLut = lum_s_45;
case 9
colLut = lum_s_135;
end
%LMS values of each color, ls to LMS
for iLMS = 1:2
cLMS(iLMS,1) = colLut(iLMS,1)*colLut(iLMS, 3);
cLMS(iLMS,2) = (1-colLut(iLMS,1))*colLut(iLMS, 3);
cLMS(iLMS,3) = colLut(iLMS,2)*colLut(iLMS, 3);
end
%XYZ values for each
for iXYZ = 1:length(cLMS(:,1))
cXYZ(iXYZ,:) = LMS_to_XYZ(cLMS(iXYZ,:));
end
%use lut to find corrected monitor RGB values for each rgb color
for iRGB = 1:length(cXYZ(:,1))
cRGB(iRGB,:) = XYZ_to_RGB(cXYZ(iRGB,:), maxPhosXYZ);
cRGB(iRGB,1) = pix(dsearchn(redProp(:), cRGB(iRGB,1)))*hfpRG;
cRGB(iRGB,2) = pix(dsearchn(grnProp(:), cRGB(iRGB,2)));
cRGB(iRGB,3) = pix(dsearchn(blueProp(:), cRGB(iRGB,3)))*hfpBG;
end
rampLeft = zeros(nFrames,3);
rampRight = zeros(nFrames,3);
for iRamp = 1:3 %for 3 phosophors
rampLeft(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(1,iRamp), nFrames);
rampRight(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(2,iRamp), nFrames);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% loadCombined =1;
% if loadCombined
% rampLeft = importdata('rampLeft_Combined.mat');
% rampRight = importdata('rampRight_Combined.mat');
% end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%create random start point for clock hand
randStrt = randi(handInt-1); %won't pick midnight as start point due to second hand array not being long enough
%clock set to go around 1 full circle
for ihand = 1:handInt*clFrames+clFrames
th(ihand) = (secHandMove(randStrt*clFrames-clFrames+ihand));
[handx(ihand), handy(ihand)] = pol2cart(th(ihand),1*rad);
end
handxLft = handx + lftXCircleCenter;
handyLft = handy + ycent;
handxRht = handx + rhtXCircleCenter;
handyRht = handy + ycent;
WaitSecs(5); %a short adaptation before the next trial
keypress = 0;
count = 0; %for clock hand
TrialCountStr = num2str(TrialCount);
Priority(topPriorityLevel);
FlushEvents('mouseDown','keyDown');
%ListenChar(2)
secs0 = Screen('Flip', window);
for iFrames = 1:nFrames
Screen('FillArc', window, rampLeft(iFrames,:), tstCircleLeft, 0, 180);
Screen('FillArc', window, rampRight(iFrames,:), tstCircleRight, 180, 180);
Screen('DrawDots', window, clockLftPosMat,clockPix, blackLut, [lftXCircleCenter,center(2)], 2);
Screen('DrawDots', window, clockRhtPosMat,clockPix, blackLut, [rhtXCircleCenter,center(2)], 2);
Screen('DrawDots', window, [0 0],clockPix, 0, [lftXCircleCenter,center(2)], 2); % black dot for fixation
Screen('DrawDots', window, [0 0],clockPix, 0, [rhtXCircleCenter,center(2)], 2); % black dot for fixation
Screen('DrawText', window, TrialCountStr, 20, 20, redLut, wRGB);
for itxt = 1:12
textNum = num2str(textOne(itxt));
Screen('DrawText', window, textNum, 1.18*clockRhtNumMat(1,itxt)+rhtXCircleCenter-7, 1.18*clockRhtNumMat(2,itxt)+center(1,2)-7, blackLut, wRGB);
textNum = num2str(textOne(itxt+12));
Screen('DrawText', window, textNum, 1.18*clockLftNumMat(1,itxt)+lftXCircleCenter-7, 1.18*clockLftNumMat(2,itxt)+center(1,2)-7, blackLut, wRGB);
end
if iFrames == clFrmStart
beep;
end
if iFrames > clFrmStart-1 && iFrames < clFrmStart + handInt*clFrames+5
count = count+1;
Screen('DrawLine', window, redLut, lftXCircleCenter, ycent, handxLft(count), handyLft(count), 2.5);
Screen('DrawLine', window, redLut, rhtXCircleCenter, ycent, handxRht(count), handyRht(count), 2.5);
end
% % %-----------------
% % % PrintScreen of the monitor (for the paper)
% % % GetImage call. Alter the rect argument to change the location of the screen shot
% % imageArray = Screen('GetImage', window, [0 0 300 300]);
% % % imwrite is a Matlab function, not a PTB-3 function
% % imwrite(imageArray, 'test.jpg')
% % %------------------
vbl = Screen('Flip', window, secs0 + (waitframes - 0.5) * ifi);
Screen('DrawingFinished', window); % tell psychtoolbox drawing is finished, should help timing
end
Priority(0);
% % % % while ~keypress
% % % % if CharAvail
% % % % userRes = input(' ');
% % % % keypress = 1;
% % % % end
% % % % end
% % % % FlushEvents('mouseDown','keyDown');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% RESPONSES %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if Simu_chck
userRes = 'simu';
else
keyIsDown=0;
kbName=[];
Digit = [];
Nums = {'0','1','2','3','4','5','6','7','8','9'};
Screen('TextSize', window, 30);
commandwindow;
while keyIsDown==0 | (strcmp('ENTER',kbName)==0)% & strcmp('2',kbName)==0)
keyIsDown=0;
[keyIsDown, secs, keyCode] = KbCheck;
if keyIsDown==1 %
kbName = KbName(keyCode);
end
if Digit & any(strcmp(Nums(:),kbName));
idx=find(strcmp(Nums(:),kbName));
NumPressed = Nums{idx};
kbName = strcat(firstDigit,NumPressed);
userRes = kbName;
% DrawFormattedText(window, kbName, 'center', 'center', color);
DrawFormattedText(window, kbName, 400, 512, redLut);
Screen('Flip', window);
kbName = [];
Digit = 0;
WaitSecs(.4);
elseif any(strcmp(Nums(:),kbName))
idx=find(strcmp(Nums(:),kbName));
NumPressed = Nums{idx};
userRes = kbName;
%-si es numero -- llevarlo a la pantalla
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
Digit = 1 ;% flag to mean that
firstDigit = kbName;
WaitSecs(.4);
kbName = [];
end
if strcmp('DELETE',kbName)==1 %-si es el backspace --limpiar numero
kbName = []% ;
userRes = kbName
firstDigit = [];
Digit = 0;
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
%else % -si no es numero -- ignorar
WaitSecs(.4);
end
end %end while
end
% userRes = num2str(2);
AfterResp = 'OK'
Screen('TextSize', window, 14);
FlushEvents('mouseDown','keyDown');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SAVE %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
% aa = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\A Outputs')
cd
WaitSecs(.2)
time = clock;
fprintf(fp, '%s\t%i/%i/%i %i:%i:%i\t%1.3f\t%1.3f\t%1.3f\t%1.3f\t%i\t%i\t%i\t%i\t%s\tExperiment\n',...
subName, time(2), time(3), time(1), time(4), time(5), round(time(6)), hfpRG, hfpBG, Bckg_Chro(iChro,1), Bckg_Chro(iChro,2), cont(iCont), curr_axis(iCond), Card_Dir, randStrt+5, userRes);
% a = cd('/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/4 ColBackg AI'); %
% a = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\4 AfterImage'); %
cd
WaitSecs(.2)
%ListenChar(0)
Screen('FillRect', window, wRGB, windowRect);
Screen('Flip', window);
clear secHandCord colLut
TrialCount = TrialCount+1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% WANT TO STOP? %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% pause(3)
yesno=evalin('base','Stop_Press')
if yesno==1
return
end
end %ICond
end %iCont
end %iRep
end %iChro
fclose(fp);
sca
%create a matrix of seconds compared to pi values for each frame - just
%used in data analysis
% % % % piVSsecs(:,1) = [0:1/(nFrames-1):1];
% % % % piVSsecs(:,2) = [0:numSecs/(nFrames-1):numSecs];
catch
warndlg('The program failed to run. Try again.')
return
end
end

459
002 After Image GUI Project/AfIm_Exp_borrar.m

@ -0,0 +1,459 @@
function AfIm_Exp(subName,meanLum,Bckg_Chro,axis_chck,AdaptTime,nRep,Train_chck)
% Check that Psychtoolbox is properly installed, switch to unified KbName's
% across operating systems, and switch color range to normalized 0 - 1 range:
PsychDefaultSetup(2);
saveFile = sprintf('%s_afterimage', subName)
aa = cd('/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/A Outputs');
fp = fopen(saveFile, 'at');
%% Color information, load hfp data and color calibration
aa = cd('/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/A Outputs');
hfpFile = sprintf('%sHFP', subName);
load(hfpFile, '-mat')
hfpRG = rg_avg;
hfpBG = bg_avg;
cd(a); % return to program folder.
Calib_Dire = cd('/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/002 After Image GUI Project');
load colorCalFile1.mat
fprintf('\nLast calibration was %s\n', describe.date)
pix = pix/1001;
cd(aa) ;% output folder
aa = cd('/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/A Outputs');
% aa = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\A Outputs')
% maxLum = 20; %cd/m^2
contFile = sprintf('%s_ContMatch', subName);
cd
load(contFile, '-mat')
% % % % lCont = fliplr(Final_lCont_avg);% sort the matrix in descendent order
% % % % lumMod = fliplr(Final_lumMod_avg);
% % % %
% % % % sCont = [.8 .65 .5 .35];
% % % % nCont = 4;
% lCont = Final_lCont_avg(:,4:5);
% lumMod = Final_lumMod_avg(:,4:5);
% sCont = [.5 .65
% .5 .65
% .5 .65
% .5 .65];
%
% nCont = 2;
lCont = Final_lCont_avg;
lumMod = Final_lumMod_avg;
sCont = [.5 .65];
% .5 .65
% .5 .65
% .5 .65];
nCont = size(sCont,2);
nBckg_Chro = size(Bckg_Chro,1);
% white = [.665 1];
blackLut = [0 0 0];
redLut = [.8 0 0];
% Bckg_Chro = Final_lCont_avg(:,1:2)
%% Save Session Information
theDate = fix(clock);
a = '/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/4 ColBackg AI' ;% folder where the program is.
infoFile = sprintf('%s_SessionsInfo', subName)
aa = cd('/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/A Outputs'); ;% folder where the program is.
cd
fo = fopen(infoFile, 'at')
fprintf(fo, '%s\t%i/%i/%i %i:%i:%i\t %1.2f\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\n',...
subName, theDate(2), theDate(3), theDate(1), theDate(4), theDate(5), round(theDate(6)),...
meanLum, nBckg_Chro, nCont, nRep,axis_chck(1),axis_chck(2),...
axis_chck(3),axis_chck(4) ,axis_chck(5),axis_chck(6),...
axis_chck(7),axis_chck(8),axis_chck(9));
% % % % fprintf(fo, '%s\t%i/%i/%i %i:%i:%i\t %1.2f\t%1.3f\t%1.3f\t%i\n',...
% % % % subName, theDate(2), theDate(3), theDate(1), theDate(4), theDate(5), round(theDate(6)),...
% % % % maxLum, white(1),white(2), nRep)%,curr_cond(1),curr_cond(2),...
% % % % % % curr_cond(3),curr_cond(4) ,curr_cond(5),curr_cond(6),...
% % % % % % curr_cond(7),curr_cond(8),curr_cond(9));
fclose(fo)
%% set up psych toolbox
%set up 10 bit color
PsychImaging('PrepareConfiguration');
%PsychImaging('AddTask', 'General', 'EnableNative10BitFrameBuffer',1); %the 0 is turn off dithering?
expScreen = 1;
%create white LUT
cd(a);
% % % wLMS(1,1) = white(1,1)*maxLum;
% % % wLMS(1,2) = (1-white(1,1))*maxLum;
% % % wLMS(1,3) = white(1,2)*maxLum;
% % % wXYZ(1,:) = LMS_to_XYZ(wLMS(1,:));
% % % wRGB(1,:) = XYZ_to_RGB(wXYZ(1,:), maxPhosXYZ);
% % % wRGB(1,1) = pix(dsearchn(redProp(:), wRGB(1,1)))*hfpRG;
% % % wRGB(1,2) = pix(dsearchn(grnProp(:), wRGB(1,2)));
% % % wRGB(1,3) = pix(dsearchn(blueProp(:), wRGB(1,3)))*hfpBG;
[window, windowRect] = PsychImaging('OpenWindow', expScreen, [0 0 0], [], [], []); % Set a black screen before starting
%Screen('OpenWindow',0, [0 0 0]); %makes main screen dark
%PsychImaging('OpenWindow', expScreen, wRGB);
[xcent,ycent] = RectCenter(windowRect);
center = [xcent ycent];
%% TIMING
%find frames per second
ifi = Screen('GetFlipInterval', window);% Measure the vertical refresh rate of the monitor
topPriorityLevel = MaxPriority(window);% Retreive the maximum priority number
numSecs = 16; %in seconds, total presentation time
framesPerSec = round(1/ifi);
nFrames = numSecs * framesPerSec;
waitframes = 1; %number of frames to wait between refresh
% color changed .03 of full cycle per second - finished 1/2 cycle in 16 seconds, 1/32
%in Zaidi, clock face appears at 10.15 seconds, will approximate this
%number
zaidiClock = 10.15; %is when Zaidi started in his example.
clFrmStart = floor(1/ifi*zaidiClock);
clTotTime = 2.9*2; %how long is clock in the screen
handInt = 12*2; %how many places to stop around the clock
clFrames = floor(clTotTime/handInt/ifi); %this will move the hand 15 degrees at a time, and decides how many frames to sit at each angle
%% Stimulus Size Parameters
circleDeg = 3.6;
clockPt = 0.1;
% code assumes 1 pixel = 1 arc min
pixPerDeg = 35; %at a distance of 57 cm
circlePix = circleDeg*pixPerDeg;
clockPix = clockPt*pixPerDeg;
tstcircle = [xcent - circlePix/2 ycent - circlePix/2 xcent + circlePix/2 ycent + circlePix/2];
%create circular grid for clock face and the numbers
rad = circleDeg/2*pixPerDeg; %circlePix/2-pixPerDeg/2;
radNum = (circleDeg/2) * pixPerDeg;
clockDegs = [1:15:360];
for iC = 1:length(clockDegs)
[xcFace(iC), ycFace(iC)] = pol2cart(clockDegs(iC)*pi/180, rad);
[xcNumber(iC), ycNumber(iC)] = pol2cart(clockDegs(iC)*pi/180, radNum);
end
%create matrix of dot locations
clockPosMat = [reshape(xcFace,1, length(clockDegs)); reshape(ycFace,1, length(clockDegs))];
clockNumMat = [reshape(xcNumber,1, length(clockDegs)); reshape(ycNumber,1, length(clockDegs))];
Screen('TextSize', window, 14);
textOne = [6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 2 3 4 5];
yPositionIsBaseline=1;
%create array of second hand positions to index
count = 1;
secHandCord(1:handInt) = (1:15:360)*(pi/180);
for iMove = 1:length(secHandCord)
secHandMove(count:count+clFrames-1) = secHandCord(iMove);
count = count+clFrames;
end
secHandMove(length(secHandMove)+1:length(secHandMove)*2) = secHandMove(1:length(secHandMove));
WaitSecs(1);
%%/////////////////////////////////////////////////////////////////////////
%%///////////////////////// EXPERIMENT TRIALS /////////////////////////////
%%/////////////////////////////////////////////////////////////////////////
clear iCond
curr_axis = find(axis_chck)
TrialCount = 1;
%run experiment
TrialCount = 1;
for iRep = 1:nRep
cont = randperm(nCont); %randomize contrast conditions
for iChro = 1:size(Bckg_Chro,1)
wLMS(1,1) = Bckg_Chro(iChro,1)*meanLum;
wLMS(1,2) = (1-Bckg_Chro(iChro,1))*meanLum;
wLMS(1,3) = Bckg_Chro(iChro,2)*meanLum;
wXYZ(1,:) = LMS_to_XYZ(wLMS(1,:));
wRGB(1,:) = XYZ_to_RGB(wXYZ(1,:), maxPhosXYZ);
wRGB(1,1) = pix(dsearchn(redProp(:), wRGB(1,1)))*hfpRG;
wRGB(1,2) = pix(dsearchn(grnProp(:), wRGB(1,2)));
wRGB(1,3) = pix(dsearchn(blueProp(:), wRGB(1,3)))*hfpBG;
Screen('FillRect', window, wRGB);
Screen('Flip',window)
WaitSecs(AdaptTime)
for iCont = 1:nCont
FlushEvents('mouseDown','keyDown');
%create colors with depending on contrast
l = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(cont(iCont))) Bckg_Chro(iChro,2) meanLum
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(cont(iCont))) Bckg_Chro(iChro,2) meanLum]; %+l, -l
s = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(cont(iCont))) meanLum
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(cont(iCont))) meanLum];%+s, -s
lum = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2) meanLum-lumMod(cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2) meanLum+lumMod(cont(iCont))];
l_s_45 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(cont(iCont))) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(cont(iCont))) meanLum
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(cont(iCont))) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(cont(iCont))) meanLum];
l_s_135 = [Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(cont(iCont))) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(cont(iCont))) meanLum
Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(cont(iCont))) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(cont(iCont))) meanLum];
lum_l_45 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(cont(iCont))) Bckg_Chro(iChro,2) meanLum+lumMod(cont(iCont))
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(cont(iCont))) Bckg_Chro(iChro,2) meanLum-lumMod(cont(iCont))];
lum_l_135 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(cont(iCont))) Bckg_Chro(iChro,2) meanLum-lumMod(cont(iCont))
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(cont(iCont))) Bckg_Chro(iChro,2) meanLum+lumMod(iChro,cont(iCont))];
lum_s_45 = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(cont(iCont))) meanLum+lumMod(cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(cont(iCont))) meanLum-lumMod(cont(iCont))];
lum_s_135 = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(cont(iCont))) meanLum-lumMod(cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(cont(iCont))) meanLum+lumMod(cont(iCont))];
rnd_idx = randperm(length(curr_axis));
curr_axis = curr_axis(rnd_idx)
% cond = randperm(9);
for iCond = 1:length(curr_axis)
%create table of color changes
switch curr_axis(iCond)
case 1
colLut = l;
case 2
colLut = s;
case 3 %%%% ATENCION que ahora LUM es la condicion 3
colLut = lum;
case 4
colLut = l_s_45;
case 5
colLut = l_s_135;
case 6
colLut = lum_l_45;
case 7
colLut = lum_l_135;
case 8
colLut = lum_s_45;
case 9
colLut = lum_s_135;
end
%LMS values of each color, ls to LMS
for iLMS = 1:2
cLMS(iLMS,1) = colLut(iLMS,1)*colLut(iLMS, 3);
cLMS(iLMS,2) = (1-colLut(iLMS,1))*colLut(iLMS, 3);
cLMS(iLMS,3) = colLut(iLMS,2)*colLut(iLMS, 3);
end
%XYZ values for each
for iXYZ = 1:length(cLMS(:,1))
cXYZ(iXYZ,:) = LMS_to_XYZ(cLMS(iXYZ,:));
end
%use lut to find corrected monitor RGB values for each rgb color
for iRGB = 1:length(cXYZ(:,1))
cRGB(iRGB,:) = XYZ_to_RGB(cXYZ(iRGB,:), maxPhosXYZ);
cRGB(iRGB,1) = pix(dsearchn(redProp(:), cRGB(iRGB,1)))*hfpRG;
cRGB(iRGB,2) = pix(dsearchn(grnProp(:), cRGB(iRGB,2)));
cRGB(iRGB,3) = pix(dsearchn(blueProp(:), cRGB(iRGB,3)))*hfpBG;
end
rampLeft = zeros(nFrames,3);
rampRight = zeros(nFrames,3);
for iRamp = 1:3 %for 3 phosophors
rampLeft(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(1,iRamp), nFrames);
rampRight(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(2,iRamp), nFrames);
end
%create random start point for clock hand
randStrt = randi(handInt-1); %won't pick midnight as start point due to second hand array not being long enough
%clock set to go around 1 full circle
for ihand = 1:handInt*clFrames+clFrames
th(ihand) = (secHandMove(randStrt*clFrames-clFrames+ihand));
[handx(ihand), handy(ihand)] = pol2cart(th(ihand),rad);
end
handx = handx + xcent;
handy = handy + ycent;
WaitSecs(5); %a short adaptation before the next trial
keypress = 0;
count = 0; %for clock hand
TrialCountStr = num2str(TrialCount);
Priority(topPriorityLevel);
FlushEvents('mouseDown','keyDown');
%ListenChar(2)
secs0 = Screen('Flip', window);
for iFrames = 1:nFrames
Screen('FillArc', window, rampLeft(iFrames,:), tstcircle, 0, 180);
Screen('FillArc', window, rampRight(iFrames,:), tstcircle, 180, 180);
Screen('DrawDots', window, clockPosMat,clockPix, redLut, center, 2);
Screen('DrawDots', window, [0 0],clockPix, 0, center, 2); % black dot for fixation
Screen('DrawText', window, TrialCountStr, 20, 20, redLut, wRGB);
for itxt = 1:24
textNum = sprintf('%i', textOne(itxt));
Screen('DrawText', window, textNum, 1.18*clockNumMat(1,itxt)+center(1,1)-7, 1.18*clockNumMat(2,itxt)+center(1,2)-7, redLut, wRGB);
end
if iFrames == clFrmStart
beep;
end
if iFrames > clFrmStart-1 && iFrames < clFrmStart + handInt*clFrames+5
count = count+1;
Screen('DrawLine', window, redLut, xcent, ycent, handx(count), handy(count), 2.5);
end
vbl = Screen('Flip', window, secs0 + (waitframes - 0.5) * ifi);
Screen('DrawingFinished', window); % tell psychtoolbox drawing is finished, should help timing
end
Priority(0);
% % % % while ~keypress
% % % % if CharAvail
% % % % userRes = input(' ');
% % % % keypress = 1;
% % % % end
% % % % end
% % % % FlushEvents('mouseDown','keyDown');
keyIsDown=0;
kbName=[];
Digit = [];
Nums = {'0','1','2','3','4','5','6','7','8','9'};
Screen('TextSize', window, 30);
commandwindow;
while keyIsDown==0 | (strcmp('ENTER',kbName)==0)% & strcmp('2',kbName)==0)
keyIsDown=0;
[keyIsDown, secs, keyCode] = KbCheck;
if keyIsDown==1 %
kbName = KbName(keyCode);
end
if Digit & any(strcmp(Nums(:),kbName));
idx=find(strcmp(Nums(:),kbName));
NumPressed = Nums{idx};
kbName = strcat(firstDigit,NumPressed);
userRes = kbName;
% DrawFormattedText(window, kbName, 'center', 'center', color);
DrawFormattedText(window, kbName, 400, 512, redLut);
Screen('Flip', window);
kbName = [];
Digit = 0;
WaitSecs(.4);
elseif any(strcmp(Nums(:),kbName))
idx=find(strcmp(Nums(:),kbName));
NumPressed = Nums{idx};
userRes = kbName;
%-si es numero -- llevarlo a la pantalla
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
Digit = 1 ;% flag to mean that
firstDigit = kbName;
WaitSecs(.4);
kbName = [];
end
if strcmp('DELETE',kbName)==1 %-si es el backspace --limpiar numero
kbName = []% ;
userRes = kbName
firstDigit = [];
Digit = 0;
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
%else % -si no es numero -- ignorar
WaitSecs(.4);
end
end %end while
% userRes = num2str(2);
AfterResp = 'OK'
Screen('TextSize', window, 14);
FlushEvents('mouseDown','keyDown');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SAVE %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
aa = cd('/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/A Outputs');
% aa = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\A Outputs')
cd
WaitSecs(.2)
time = clock;
fprintf(fp, '%s\t%i/%i/%i %i:%i:%i\t%1.3f\t%1.3f\t%1.3f\t%1.3f\t%i\t%i\t%i\t%s\tExperiment\n',...
subName, time(2), time(3), time(1), time(4), time(5), round(time(6)), hfpRG, hfpBG, Bckg_Chro(iChro,1), Bckg_Chro(iChro,2), cont(iCont), curr_axis(iCond), randStrt+5, userRes);
a = cd('/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/4 ColBackg AI'); %
% a = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\4 AfterImage'); %
cd
WaitSecs(.2)
%ListenChar(0)
Screen('FillRect', window, wRGB, windowRect);
Screen('Flip', window);
clear secHandCord colLut
TrialCount = TrialCount+1
end %ICond
end %iCont
end %iChro
end %iRep
fclose(fp);
sca
%create a matrix of seconds compared to pi values for each frame - just
%used in data analysis
piVSsecs(:,1) = [0:1/(nFrames-1):1];
piVSsecs(:,2) = [0:numSecs/(nFrames-1):numSecs];
end

464
002 After Image GUI Project/AfIm_Exp_borrarr.m

@ -0,0 +1,464 @@
function AfIm_Exp(subName,numRep,maxLum,Bckg_Chro,cond_chck,Adapt_chck)
% Check that Psychtoolbox is properly installed, switch to unified KbName's
% across operating systems, and switch color range to normalized 0 - 1 range:
PsychDefaultSetup(2);
nBckg_Chro = size(Bckg_Chro,1);
nCont = 2
theDate = fix(clock);
a = '/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/4 ColBackg AI' ;% folder where the program is.
infoFile = sprintf('%s_SessionsInfo', subName)
aa = cd('/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/A Outputs'); ;% folder where the program is.
cd
fo = fopen(infoFile, 'at')
fprintf(fo, '%s\t%i/%i/%i %i:%i:%i\t %1.2f\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\n',...
subName, theDate(2), theDate(3), theDate(1), theDate(4), theDate(5), round(theDate(6)),...
maxLum, nBckg_Chro, nCont, numRep,cond_chck(1),cond_chck(2),...
cond_chck(3),cond_chck(4) ,cond_chck(5),cond_chck(6),...
cond_chck(7),cond_chck(8),cond_chck(9));
% % % % fprintf(fo, '%s\t%i/%i/%i %i:%i:%i\t %1.2f\t%1.3f\t%1.3f\t%i\n',...
% % % % subName, theDate(2), theDate(3), theDate(1), theDate(4), theDate(5), round(theDate(6)),...
% % % % maxLum, white(1),white(2), numRep)%,curr_cond(1),curr_cond(2),...
% % % % % % curr_cond(3),curr_cond(4) ,curr_cond(5),curr_cond(6),...
% % % % % % curr_cond(7),curr_cond(8),curr_cond(9));
fclose(fo)
saveFile = sprintf('%s_afterimage', subName)
aa = cd('/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/A Outputs');
fp = fopen(saveFile, 'at');
%% Color information, load hfp data and color calibration
aa = cd('/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/A Outputs');
hfpFile = sprintf('%sHFP', subName);
load(hfpFile, '-mat')
hfpRG = rg_avg;
hfpBG = bg_avg;
cd(a); % return to program folder.
Calib_Dire = cd('/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/002 After Image GUI Project');
load colorCalFile1.mat
fprintf('\nLast calibration was %s\n', describe.date)
pix = pix/1001;
cd(aa) ;% output folder
aa = cd('/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/A Outputs');
% aa = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\A Outputs')
% maxLum = 20; %cd/m^2
contFile = sprintf('%s_ContMatch', subName);
cd
load(contFile, '-mat')
% % % % lCont = fliplr(Final_lCont_avg);% sort the matrix in descendent order
% % % % lumMod = fliplr(Final_lumMod_avg);
% % % %
% % % % sCont = [.8 .65 .5 .35];
% % % % numCont = 4;
% lCont = Final_lCont_avg(:,4:5);
% lumMod = Final_lumMod_avg(:,4:5);
% sCont = [.5 .65
% .5 .65
% .5 .65
% .5 .65];
%
% numCont = 2;
lCont = Final_lCont_avg;
lumMod = Final_lumMod_avg;
sCont = [.5 .65
.5 .65
.5 .65
.5 .65];
numCont = size(sCont,2);
% white = [.665 1];
blackLut = [0 0 0];
redLut = [.8 0 0];
% Bckg_Chro = Final_lCont_avg(:,1:2)
%% set up psych toolbox
%set up 10 bit color
PsychImaging('PrepareConfiguration');
%PsychImaging('AddTask', 'General', 'EnableNative10BitFrameBuffer',1); %the 0 is turn off dithering?
expScreen = 1;
%create white LUT
cd(a);
% % % wLMS(1,1) = white(1,1)*maxLum;
% % % wLMS(1,2) = (1-white(1,1))*maxLum;
% % % wLMS(1,3) = white(1,2)*maxLum;
% % % wXYZ(1,:) = LMS_to_XYZ(wLMS(1,:));
% % % wRGB(1,:) = XYZ_to_RGB(wXYZ(1,:), maxPhosXYZ);
% % % wRGB(1,1) = pix(dsearchn(redProp(:), wRGB(1,1)))*hfpRG;
% % % wRGB(1,2) = pix(dsearchn(grnProp(:), wRGB(1,2)));
% % % wRGB(1,3) = pix(dsearchn(blueProp(:), wRGB(1,3)))*hfpBG;
[window, windowRect] = PsychImaging('OpenWindow', expScreen, [0 0 0], [], [], []); % Set a black screen before starting
%Screen('OpenWindow',0, [0 0 0]); %makes main screen dark
%PsychImaging('OpenWindow', expScreen, wRGB);
[xcent,ycent] = RectCenter(windowRect);
center = [xcent ycent];
%% TIMING
%find frames per second
ifi = Screen('GetFlipInterval', window);% Measure the vertical refresh rate of the monitor
topPriorityLevel = MaxPriority(window);% Retreive the maximum priority number
numSecs = 16; %in seconds, total presentation time
framesPerSec = round(1/ifi);
nFrames = numSecs * framesPerSec;
waitframes = 1; %number of frames to wait between refresh
% color changed .03 of full cycle per second - finished 1/2 cycle in 16 seconds, 1/32
%in Zaidi, clock face appears at 10.15 seconds, will approximate this
%number
zaidiClock = 10.15; %is when Zaidi started in his example.
clFrmStart = floor(1/ifi*zaidiClock);
clTotTime = 2.9*2; %how long is clock in the screen
handInt = 12*2; %how many places to stop around the clock
clFrames = floor(clTotTime/handInt/ifi); %this will move the hand 15 degrees at a time, and decides how many frames to sit at each angle
%% Stimulus Size Parameters
circleDeg = 3.6;
clockPt = 0.1;
% code assumes 1 pixel = 1 arc min
pixPerDeg = 35; %at a distance of 57 cm
circlePix = circleDeg*pixPerDeg;
clockPix = clockPt*pixPerDeg;
tstcircle = [xcent - circlePix/2 ycent - circlePix/2 xcent + circlePix/2 ycent + circlePix/2];
%create circular grid for clock face and the numbers
rad = circleDeg/2*pixPerDeg; %circlePix/2-pixPerDeg/2;
radNum = (circleDeg/2) * pixPerDeg;
clockDegs = [1:15:360];
for iC = 1:length(clockDegs)
[xcFace(iC), ycFace(iC)] = pol2cart(clockDegs(iC)*pi/180, rad);
[xcNumber(iC), ycNumber(iC)] = pol2cart(clockDegs(iC)*pi/180, radNum);
end
%create matrix of dot locations
clockPosMat = [reshape(xcFace,1, length(clockDegs)); reshape(ycFace,1, length(clockDegs))];
clockNumMat = [reshape(xcNumber,1, length(clockDegs)); reshape(ycNumber,1, length(clockDegs))];
Screen('TextSize', window, 14);
textOne = [6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 2 3 4 5];
yPositionIsBaseline=1;
%create array of second hand positions to index
count = 1;
secHandCord(1:handInt) = (1:15:360)*(pi/180);
for iMove = 1:length(secHandCord)
secHandMove(count:count+clFrames-1) = secHandCord(iMove);
count = count+clFrames;
end
secHandMove(length(secHandMove)+1:length(secHandMove)*2) = secHandMove(1:length(secHandMove));
numRep = 1; %number of times to repeat the experiment
WaitSecs(1);
%%/////////////////////////////////////////////////////////////////////////
%%///////////////////////// EXPERIMENT TRIALS /////////////////////////////
%%/////////////////////////////////////////////////////////////////////////
clear iCond
curr_axis = find(cond_chck)
TrialCount = 1;
%run experiment
TrialCount = 1;
for iRep = 1:numRep
cont = randperm(numCont); %randomize contrast conditions
for iChro = 1:size(Bckg_Chro,1)
wLMS(1,1) = Bckg_Chro(iChro,1)*maxLum;
wLMS(1,2) = (1-Bckg_Chro(iChro,1))*maxLum;
wLMS(1,3) = Bckg_Chro(iChro,2)*maxLum;
wXYZ(1,:) = LMS_to_XYZ(wLMS(1,:));
wRGB(1,:) = XYZ_to_RGB(wXYZ(1,:), maxPhosXYZ);
wRGB(1,1) = pix(dsearchn(redProp(:), wRGB(1,1)))*hfpRG;
wRGB(1,2) = pix(dsearchn(grnProp(:), wRGB(1,2)));
wRGB(1,3) = pix(dsearchn(blueProp(:), wRGB(1,3)))*hfpBG;
Screen('FillRect', window, wRGB);
Screen('Flip',window)
WaitSecs(60)
for iCont = 1:numCont
FlushEvents('mouseDown','keyDown');
%create colors with depending on contrast
l = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) maxLum
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) maxLum]; %+l, -l
s = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) maxLum
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) maxLum];%+s, -s
lum = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2) maxLum-lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2) maxLum+lumMod(iChro,cont(iCont))];
l_s_45 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) maxLum
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) maxLum];
l_s_135 = [Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) maxLum
Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) maxLum];
lum_l_45 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) maxLum+lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) maxLum-lumMod(iChro,cont(iCont))];
lum_l_135 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) maxLum-lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) maxLum+lumMod(iChro,cont(iCont))];
lum_s_45 = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) maxLum+lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) maxLum-lumMod(iChro,cont(iCont))];
lum_s_135 = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) maxLum-lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) maxLum+lumMod(iChro,cont(iCont))];
rnd_idx = randperm(length(curr_axis));
curr_axis = curr_axis(rnd_idx)
% cond = randperm(9);
for iCond = 1:length(curr_axis)
%create table of color changes
switch curr_axis(iCond)
case 1
colLut = l;
case 2
colLut = s;
case 3 %%%% ATENCION que ahora LUM es la condicion 3
colLut = lum;
case 4
colLut = l_s_45;
case 5
colLut = l_s_135;
case 6
colLut = lum_l_45;
case 7
colLut = lum_l_135;
case 8
colLut = lum_s_45;
case 9
colLut = lum_s_135;
end
%LMS values of each color, ls to LMS
for iLMS = 1:2
cLMS(iLMS,1) = colLut(iLMS,1)*colLut(iLMS, 3);
cLMS(iLMS,2) = (1-colLut(iLMS,1))*colLut(iLMS, 3);
cLMS(iLMS,3) = colLut(iLMS,2)*colLut(iLMS, 3);
end
%XYZ values for each
for iXYZ = 1:length(cLMS(:,1))
cXYZ(iXYZ,:) = LMS_to_XYZ(cLMS(iXYZ,:));
end
%use lut to find corrected monitor RGB values for each rgb color
for iRGB = 1:length(cXYZ(:,1))
cRGB(iRGB,:) = XYZ_to_RGB(cXYZ(iRGB,:), maxPhosXYZ);
cRGB(iRGB,1) = pix(dsearchn(redProp(:), cRGB(iRGB,1)))*hfpRG;
cRGB(iRGB,2) = pix(dsearchn(grnProp(:), cRGB(iRGB,2)));
cRGB(iRGB,3) = pix(dsearchn(blueProp(:), cRGB(iRGB,3)))*hfpBG;
end
rampLeft = zeros(nFrames,3);
rampRight = zeros(nFrames,3);
for iRamp = 1:3 %for 3 phosophors
rampLeft(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(1,iRamp), nFrames);
rampRight(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(2,iRamp), nFrames);
end
%create random start point for clock hand
randStrt = randi(handInt-1); %won't pick midnight as start point due to second hand array not being long enough
%clock set to go around 1 full circle
for ihand = 1:handInt*clFrames+clFrames
th(ihand) = (secHandMove(randStrt*clFrames-clFrames+ihand));
[handx(ihand), handy(ihand)] = pol2cart(th(ihand),rad);
end
handx = handx + xcent;
handy = handy + ycent;
WaitSecs(5); %a short adaptation before the next trial
keypress = 0;
count = 0; %for clock hand
TrialCountStr = num2str(TrialCount);
Priority(topPriorityLevel);
FlushEvents('mouseDown','keyDown');
%ListenChar(2)
secs0 = Screen('Flip', window);
for iFrames = 1:nFrames
Screen('FillArc', window, rampLeft(iFrames,:), tstcircle, 0, 180);
Screen('FillArc', window, rampRight(iFrames,:), tstcircle, 180, 180);
Screen('DrawDots', window, clockPosMat,clockPix, redLut, center, 2);
Screen('DrawDots', window, [0 0],clockPix, 0, center, 2); % black dot for fixation
Screen('DrawText', window, TrialCountStr, 20, 20, redLut, wRGB);
for itxt = 1:24
textNum = sprintf('%i', textOne(itxt));
Screen('DrawText', window, textNum, 1.18*clockNumMat(1,itxt)+center(1,1)-7, 1.18*clockNumMat(2,itxt)+center(1,2)-7, redLut, wRGB);
end
if iFrames == clFrmStart
beep;
end
if iFrames > clFrmStart-1 && iFrames < clFrmStart + handInt*clFrames+5
count = count+1;
Screen('DrawLine', window, redLut, xcent, ycent, handx(count), handy(count), 2.5);
end
vbl = Screen('Flip', window, secs0 + (waitframes - 0.5) * ifi);
Screen('DrawingFinished', window); % tell psychtoolbox drawing is finished, should help timing
end
Priority(0);
% % % % while ~keypress
% % % % if CharAvail
% % % % userRes = input(' ');
% % % % keypress = 1;
% % % % end
% % % % end
% % % % FlushEvents('mouseDown','keyDown');
keyIsDown=0;
kbName=[];
Digit = [];
Nums = {'0','1','2','3','4','5','6','7','8','9'};
Screen('TextSize', window, 30);
commandwindow;
while keyIsDown==0 | (strcmp('ENTER',kbName)==0)% & strcmp('2',kbName)==0)
keyIsDown=0;
[keyIsDown, secs, keyCode] = KbCheck;
if keyIsDown==1 %
kbName = KbName(keyCode);
end
if Digit & any(strcmp(Nums(:),kbName));
idx=find(strcmp(Nums(:),kbName));
NumPressed = Nums{idx};
kbName = strcat(firstDigit,NumPressed);
userRes = kbName;
% DrawFormattedText(window, kbName, 'center', 'center', color);
DrawFormattedText(window, kbName, 400, 512, redLut);
Screen('Flip', window);
kbName = [];
Digit = 0;
WaitSecs(.4);
elseif any(strcmp(Nums(:),kbName))
idx=find(strcmp(Nums(:),kbName));
NumPressed = Nums{idx};
userRes = kbName;
%-si es numero -- llevarlo a la pantalla
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
Digit = 1 ;% flag to mean that
firstDigit = kbName;
WaitSecs(.4);
kbName = [];
end
if strcmp('DELETE',kbName)==1 %-si es el backspace --limpiar numero
kbName = []% ;
userRes = kbName
firstDigit = [];
Digit = 0;
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
%else % -si no es numero -- ignorar
WaitSecs(.4);
end
end %end while
% userRes = num2str(2);
AfterResp = 'OK'
Screen('TextSize', window, 14);
FlushEvents('mouseDown','keyDown');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SAVE %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
aa = cd('/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/A Outputs');
% aa = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\A Outputs')
cd
WaitSecs(.2)
time = clock;
fprintf(fp, '%s\t%i/%i/%i %i:%i:%i\t%1.3f\t%1.3f\t%1.3f\t%1.3f\t%i\t%i\t%i\t%s\tExperiment\n',...
subName, time(2), time(3), time(1), time(4), time(5), round(time(6)), hfpRG, hfpBG, Bckg_Chro(iChro,1), Bckg_Chro(iChro,2), cont(iCont), curr_axis(iCond), randStrt+5, userRes);
a = cd('/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/4 ColBackg AI'); %
% a = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\4 AfterImage'); %
cd
WaitSecs(.2)
%ListenChar(0)
Screen('FillRect', window, wRGB, windowRect);
Screen('Flip', window);
clear secHandCord colLut
TrialCount = TrialCount+1
end %ICond
end %iCont
end %iChro
end %iRep
fclose(fp);
sca
%create a matrix of seconds compared to pi values for each frame - just
%used in data analysis
piVSsecs(:,1) = [0:1/(nFrames-1):1];
piVSsecs(:,2) = [0:numSecs/(nFrames-1):numSecs];
end

616
002 After Image GUI Project/AfIm_Exp_copy.m

@ -0,0 +1,616 @@
function AfIm_Exp_copy(subName,numRep,maxLum,white,curr_cond)
theDate = fix(clock);
% % infoFile = sprintf('%s_SessionsInfo', subName);
% % fo = fopen(infoFile, 'at');
% % fprintf(fo, '%s\t%i/%i/%i %i:%i:%i\t %1.2f\t%1.3f\t%1.3f\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\n',...
% % subName, time(2), time(3), time(1), time(4), time(5), round(time(6)),...
% % maxLum, white(1),white(2), numRep,curr_cond(1),curr_cond(2)...
% % curr_cond(3),curr_cond(4) ,curr_cond(5),curr_cond(6),...
% % curr_cond(7),curr_cond(8),curr_cond(9));
% % fclose(fo);
% %
saveFile = sprintf('%s_afterimage', subName)
a = '/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/4 AfterImage' ;% folder where the program is.
fp = fopen(saveFile, 'at');
%% Color information, load hfp data and color calibration
aa = cd('/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/A Outputs');
hfpFile = sprintf('%sHFP', subName);
load(hfpFile, '-mat')
hfpRG = rg_avg;
hfpBG = bg_avg;
cd(a); % return to program folder.
load colorCalFile1.mat
fprintf('\nLast calibration was %s\n', describe.date);
pix = pix/1001;
cd(aa) ;% output folder
aa = cd('/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/A Outputs');
% aa = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\A Outputs')
% maxLum = 20; %cd/m^2
contFile = sprintf('%s_ContMatch', subName);
cd
load(contFile, '-mat')
lCont = fliplr(Final_lCont_avg);% sort the matrix in descendent order
lumMod = fliplr(Final_lumMod_avg);
sCont = [.8 .65 .5 .35];
numCont = 4;
% white = [.665 1];
blackLut = [0 0 0];
redLut = [.8 0 0];
%% set up psych toolbox
%set up 10 bit color
PsychImaging('PrepareConfiguration');
%PsychImaging('AddTask', 'General', 'EnableNative10BitFrameBuffer',1); %the 0 is turn off dithering?
expScreen = 1;
%create white LUT
cd(a);
wLMS(1,1) = white(1,1)*maxLum;
wLMS(1,2) = (1-white(1,1))*maxLum;
wLMS(1,3) = white(1,2)*maxLum;
wXYZ(1,:) = LMS_to_XYZ(wLMS(1,:));
wRGB(1,:) = XYZ_to_RGB(wXYZ(1,:), maxPhosXYZ);
wRGB(1,1) = pix(dsearchn(redProp(:), wRGB(1,1)))*hfpRG;
wRGB(1,2) = pix(dsearchn(grnProp(:), wRGB(1,2)));
wRGB(1,3) = pix(dsearchn(blueProp(:), wRGB(1,3)))*hfpBG;
[window, windowRect] = PsychImaging('OpenWindow', expScreen, wRGB, [], [], []); %
%Screen('OpenWindow',0, [0 0 0]); %makes main screen dark
%PsychImaging('OpenWindow', expScreen, wRGB);
[xcent,ycent] = RectCenter(windowRect);
center = [xcent ycent];
%% TIMING
%find frames per second
ifi = Screen('GetFlipInterval', window);% Measure the vertical refresh rate of the monitor
topPriorityLevel = MaxPriority(window);% Retreive the maximum priority number
numSecs = 16; %in seconds, total presentation time
framesPerSec = round(1/ifi);
nFrames = numSecs * framesPerSec;
waitframes = 1; %number of frames to wait between refresh
% color changed .03 of full cycle per second - finished 1/2 cycle in 16 seconds, 1/32
%in Zaidi, clock face appears at 10.15 seconds, will approximate this
%number
zaidiClock = 10.15; %is when Zaidi started in his example.
clFrmStart = floor(1/ifi*zaidiClock);
clTotTime = 2.9*2; %how long is clock in the screen
handInt = 12*2; %how many places to stop around the clock
clFrames = floor(clTotTime/handInt/ifi); %this will move the hand 15 degrees at a time, and decides how many frames to sit at each angle
%% Stimulus Size Parameters
circleDeg = 3.6;
clockPt = 0.1;
% code assumes 1 pixel = 1 arc min
pixPerDeg = 35; %at a distance of 57 cm
circlePix = circleDeg*pixPerDeg;
clockPix = clockPt*pixPerDeg;
tstcircle = [xcent - circlePix/2 ycent - circlePix/2 xcent + circlePix/2 ycent + circlePix/2];
%create circular grid for clock face and the numbers
rad = circleDeg/2*pixPerDeg; %circlePix/2-pixPerDeg/2;
radNum = (circleDeg/2) * pixPerDeg;
clockDegs = [1:15:360];
for iC = 1:length(clockDegs)
[xcFace(iC), ycFace(iC)] = pol2cart(clockDegs(iC)*pi/180, rad);
[xcNumber(iC), ycNumber(iC)] = pol2cart(clockDegs(iC)*pi/180, radNum);
end
%create matrix of dot locations
clockPosMat = [reshape(xcFace,1, length(clockDegs)); reshape(ycFace,1, length(clockDegs))];
clockNumMat = [reshape(xcNumber,1, length(clockDegs)); reshape(ycNumber,1, length(clockDegs))];
Screen('TextSize', window, 14);
textOne = [6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 2 3 4 5];
yPositionIsBaseline=1;
%create array of second hand positions to index
count = 1;
secHandCord(1:handInt) = (1:15:360)*(pi/180);
for iMove = 1:length(secHandCord)
secHandMove(count:count+clFrames-1) = secHandCord(iMove);
count = count+clFrames;
end
secHandMove(length(secHandMove)+1:length(secHandMove)*2) = secHandMove(1:length(secHandMove));
% numRep = 3; %number of times to repeat the experiment
WaitSecs(5);
%practice
for iprac = 1
FlushEvents('mouseDown','keyDown');
%create colors depending on contrast
l = [white(1)+(white(1)*lCont(1)) 1 maxLum
white(1)-(white(1)*lCont(1)) 1 maxLum]; %+l, -l
s = [white(1) white(2)+(white(2)*sCont(1)) maxLum
white(1) white(2)-(white(2)*sCont(1)) maxLum];%+s, -s
forFive = [white(1)+(white(1)*lCont(1)) white(2)+(white(2)*sCont(1)) maxLum
white(1)-(white(1)*lCont(1)) white(2)-(white(2)*sCont(1)) maxLum];
oneThrFive = [white(1)-(white(1)*lCont(1)) white(2)+(white(2)*sCont(1)) maxLum
white(1)+(white(1)*lCont(1)) white(2)-(white(2)*sCont(1)) maxLum];
lum = [white(1) white(2) maxLum-lumMod(1)
white(1) white(2) maxLum+lumMod(1)];
lum_l_45 = [white(1)+(white(1)*lCont(1)) white(2) maxLum+lumMod(1)
white(1)-(white(1)*lCont(1)) white(2) maxLum-lumMod(1)];
lum_l_135 = [white(1)+(white(1)*lCont(1)) white(2) maxLum-lumMod(1)
white(1)-(white(1)*lCont(1)) white(2) maxLum+lumMod(1)];
lum_s_45 = [white(1) white(2)+(white(2)*sCont(1)) maxLum+lumMod(1)
white(1) white(2)-(white(2)*sCont(1)) maxLum-lumMod(1)];
lum_s_135 = [white(1) white(2)+(white(2)*sCont(1)) maxLum-lumMod(1)
white(1) white(2)-(white(2)*sCont(1)) maxLum+lumMod(1)];
% cond = randperm(1);
cond = 1:9
rnd_idx = randperm(length(curr_cond));
curr_cond = curr_cond(rnd_idx)
% Cond = Cond(curr_cond_rnd) ;
for iCond = 1:length(curr_cond)
%create table of color changes
switch curr_cond(iCond)
case 1
colLut = l;
case 2
colLut = s;
case 3
colLut = forFive;
case 4
colLut = oneThrFive;
case 5
colLut = lum;
case 6
colLut = lum_l_45;
case 7
colLut = lum_l_135;
case 8
colLut = lum_s_45;
case 9
colLut = lum_s_135;
% % % % % % % % case 2
% % % % % % % % colLut = TEST_lum_l;
end
%LMS values of each color, ls to LMS
for iLMS = 1:2
cLMS(iLMS,1) = colLut(iLMS,1)*colLut(iLMS, 3);
cLMS(iLMS,2) = (1-colLut(iLMS,1))*colLut(iLMS, 3);
cLMS(iLMS,3) = colLut(iLMS,2)*colLut(iLMS, 3);
end
%XYZ values for each
for iXYZ = 1:length(cLMS(:,1))
cXYZ(iXYZ,:) = LMS_to_XYZ(cLMS(iXYZ,:));
end
%use lut to find corrected monitor RGB values for each rgb color
for iRGB = 1:length(cXYZ(:,1))
cRGB(iRGB,:) = XYZ_to_RGB(cXYZ(iRGB,:), maxPhosXYZ);
cRGB(iRGB,1) = pix(dsearchn(redProp(:), cRGB(iRGB,1)))*hfpRG;
cRGB(iRGB,2) = pix(dsearchn(grnProp(:), cRGB(iRGB,2)));
cRGB(iRGB,3) = pix(dsearchn(blueProp(:), cRGB(iRGB,3)))*hfpBG;
end
rampLeft = zeros(nFrames,3);
rampRight = zeros(nFrames,3);
for iRamp = 1:3 %for 3 phosophors
rampLeft(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(1,iRamp), nFrames);
rampRight(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(2,iRamp), nFrames);
end
%create random start point for clock hand
randStrt = randi(handInt-1); %won't pick midnight as start point due to second hand array not being long enough
%clock set to go around 1 full circle
for ihand = 1:handInt*clFrames+clFrames
th(ihand) = (secHandMove(randStrt*clFrames-clFrames+ihand));
[handx(ihand), handy(ihand)] = pol2cart(th(ihand),rad);
end
handx = handx + xcent;
handy = handy + ycent;
WaitSecs(3); %a short adaptation before the next trial
keypress = 0;
count = 0; %for clock hand
Priority(topPriorityLevel);
FlushEvents('mouseDown','keyDown');
%ListenChar(2)
secs0 = Screen('Flip', window);
for iFrames = 1:nFrames
Screen('FillArc', window, rampLeft(iFrames,:), tstcircle, 0, 180);
Screen('FillArc', window, rampRight(iFrames,:), tstcircle, 180, 180);
Screen('DrawDots', window, clockPosMat,clockPix, redLut, center, 2);
Screen('DrawDots', window, [0 0],clockPix, 0, center, 2); % black dot for fixation
Screen('DrawText', window, 'Pr', 20, 20, redLut, wRGB);
for itxt = 1:24
textNum = sprintf('%i', textOne(itxt));
Screen('DrawText', window, textNum, 1.18*clockNumMat(1,itxt)+center(1,1)-7, 1.18*clockNumMat(2,itxt)+center(1,2)-7, redLut, wRGB);
end
if iFrames == clFrmStart
beep;
end
if iFrames > clFrmStart-1 && iFrames < clFrmStart + handInt*clFrames+5
count = count+1;
Screen('DrawLine', window, redLut, xcent, ycent, handx(count), handy(count), 2.5);
end
vbl = Screen('Flip', window, secs0 + (waitframes - 0.5) * ifi);
Screen('DrawingFinished', window); % tell psychtoolbox drawing is finished, should help timing
end
Priority(0);
keyIsDown=0;
kbName=[];
Digit = [];
Nums = {'0','1','2','3','4','5','6','7','8','9'};
Screen('TextSize', window, 30);
commandwindow;
while keyIsDown==0 | (strcmp('ENTER',kbName)==0)% & strcmp('2',kbName)==0)
keyIsDown=0;
[keyIsDown, secs, keyCode] = KbCheck;
if keyIsDown==1 %
kbName = KbName(keyCode);
end
if Digit & any(strcmp(Nums(:),kbName))
idx=find(strcmp(Nums(:),kbName));
NumPressed = Nums{idx};
kbName = strcat(firstDigit,NumPressed);
userRes = kbName;
% DrawFormattedText(window, kbName, 'center', 'center', color);
DrawFormattedText(window, kbName, 400, 512, redLut);
Screen('Flip', window);
kbName = [];
Digit = 0;
WaitSecs(.4);
elseif any(strcmp(Nums(:),kbName))
idx=find(strcmp(Nums(:),kbName));
NumPressed = Nums{idx};
userRes = kbName;
%-si es numero -- llevarlo a la pantalla
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
Digit = 1 ;% flag to mean that
firstDigit = kbName;
WaitSecs(.4);
kbName = [];
end
if strcmp('DELETE',kbName)==1 %-si es el backspace --limpiar numero
kbName = []% ;
userRes = kbName;
firstDigit = [];
Digit = 0;
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
WaitSecs(.4);
%else % -si no es numero -- ignorar
end
end %end while
userRes
Screen('TextSize', window, 14);
FlushEvents('mouseDown','keyDown');
aa = cd('/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/A Outputs');
% aa = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\A Outputs')
cd
WaitSecs(.2)
% time = clock;
% fprintf(fp, '%s\t%i/%i/%i %i:%i:%i\t%1.3f\t%1.3f\t%i\t%i\t%s\t%i\tPractice\n',...
% subName, time(2), time(3), time(1), time(4), time(5), round(time(6)), hfpRG, hfpBG, 1, cond(iCond), randStrt+5, userRes);
time = clock;
fprintf(fp, '%s\t%i/%i/%i %i:%i:%i\t%1.3f\t%1.3f\t%i\t%i\t%i\t%s\tPractice\n',...
subName, time(2), time(3), time(1), time(4), time(5), round(time(6)), hfpRG, hfpBG, 1,curr_cond(iCond), randStrt, userRes);
a = cd('/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/4 AfterImage'); %
% a = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\4 AfterImage'); %
cd
WaitSecs(.2)
%ListenChar(0)
Screen('FillRect', window, wRGB, windowRect);
Screen('Flip', window);
clear secHandCord colLut
end
end
clear iCond
TrialCount = 1;
%run experiment
for iRep = 1:numRep
cont = randperm(numCont); %randomize contrast conditions
for iCont = 1:numCont
FlushEvents('mouseDown','keyDown');
%create colors with depending on contrast
l = [white(1)+(white(1)*lCont(cont(iCont))) white(2) maxLum
white(1)-(white(1)*lCont(cont(iCont))) white(2) maxLum]; %+l, -l
s = [white(1) white(2)+(white(2)*sCont(cont(iCont))) maxLum
white(1) white(2)-(white(2)*sCont(cont(iCont))) maxLum];%+s, -s
forFive = [white(1)+(white(1)*lCont(cont(iCont))) white(2)+(white(2)*sCont(cont(iCont))) maxLum
white(1)-(white(1)*lCont(cont(iCont))) white(2)-(white(2)*sCont(cont(iCont))) maxLum];
oneThrFive = [white(1)-(white(1)*lCont(cont(iCont))) white(2)+(white(2)*sCont(cont(iCont))) maxLum
white(1)+(white(1)*lCont(cont(iCont))) white(2)-(white(2)*sCont(cont(iCont))) maxLum];
lum = [white(1) white(2) maxLum-lumMod(cont(iCont))
white(1) white(2) maxLum+lumMod(cont(iCont))];
lum_l_45 = [white(1)+(white(1)*lCont(iCont)) white(2) maxLum+lumMod(iCont)
white(1)-(white(1)*lCont(iCont)) white(2) maxLum-lumMod(iCont)];
lum_l_135 = [white(1)+(white(1)*lCont(iCont)) white(2) maxLum-lumMod(iCont)
white(1)-(white(1)*lCont(iCont)) white(2) maxLum+lumMod(iCont)];
lum_s_45 = [white(1) white(2)+(white(2)*sCont(iCont)) maxLum+lumMod(iCont)
white(1) white(2)-(white(2)*sCont(iCont)) maxLum-lumMod(iCont)];
lum_s_135 = [white(1) white(2)+(white(2)*sCont(iCont)) maxLum-lumMod(iCont)
white(1) white(2)-(white(2)*sCont(iCont)) maxLum+lumMod(iCont)];
% cond = 1:9
rnd_idx = randperm(length(curr_cond));
curr_cond = curr_cond(rnd_idx)
% Cond = Cond(curr_cond_rnd) ;
for iCond = 1:length(curr_cond)
%create table of color changes
switch curr_cond(iCond)
% cond = randperm(9);
% for iCond = 1:9
%create table of color changes
% switch cond(iCond)
case 1
colLut = l;
case 2
colLut = s;
case 3
colLut = forFive;
case 4
colLut = oneThrFive;
case 5
colLut = lum;
case 6
colLut = lum_l_45;
case 7
colLut = lum_l_135;
case 8
colLut = lum_s_45;
case 9
colLut = lum_s_135;
end
%LMS values of each color, ls to LMS
for iLMS = 1:2
cLMS(iLMS,1) = colLut(iLMS,1)*colLut(iLMS, 3);
cLMS(iLMS,2) = (1-colLut(iLMS,1))*colLut(iLMS, 3);
cLMS(iLMS,3) = colLut(iLMS,2)*colLut(iLMS, 3);
end
%XYZ values for each
for iXYZ = 1:length(cLMS(:,1))
cXYZ(iXYZ,:) = LMS_to_XYZ(cLMS(iXYZ,:));
end
%use lut to find corrected monitor RGB values for each rgb color
for iRGB = 1:length(cXYZ(:,1))
cRGB(iRGB,:) = XYZ_to_RGB(cXYZ(iRGB,:), maxPhosXYZ);
cRGB(iRGB,1) = pix(dsearchn(redProp(:), cRGB(iRGB,1)))*hfpRG;
cRGB(iRGB,2) = pix(dsearchn(grnProp(:), cRGB(iRGB,2)));
cRGB(iRGB,3) = pix(dsearchn(blueProp(:), cRGB(iRGB,3)))*hfpBG;
end
rampLeft = zeros(nFrames,3);
rampRight = zeros(nFrames,3);
for iRamp = 1:3 %for 3 phosophors
rampLeft(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(1,iRamp), nFrames);
rampRight(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(2,iRamp), nFrames);
end
%create random start point for clock hand
randStrt = randi(handInt-1); %won't pick midnight as start point due to second hand array not being long enough
%clock set to go around 1 full circle
for ihand = 1:handInt*clFrames+clFrames
th(ihand) = (secHandMove(randStrt*clFrames-clFrames+ihand));
[handx(ihand), handy(ihand)] = pol2cart(th(ihand),rad);
end
handx = handx + xcent;
handy = handy + ycent;
WaitSecs(5); %a short adaptation before the next trial
keypress = 0;
count = 0; %for clock hand
TrialCountStr = num2str(TrialCount);
Priority(topPriorityLevel);
FlushEvents('mouseDown','keyDown');
%ListenChar(2)
secs0 = Screen('Flip', window);
for iFrames = 1:nFrames
Screen('FillArc', window, rampLeft(iFrames,:), tstcircle, 0, 180);
Screen('FillArc', window, rampRight(iFrames,:), tstcircle, 180, 180);
Screen('DrawDots', window, clockPosMat,clockPix, redLut, center, 2);
Screen('DrawDots', window, [0 0],clockPix, 0, center, 2); % black dot for fixation
Screen('DrawText', window, TrialCountStr, 20, 20, redLut, wRGB);
for itxt = 1:24
textNum = sprintf('%i', textOne(itxt));
Screen('DrawText', window, textNum, 1.18*clockNumMat(1,itxt)+center(1,1)-7, 1.18*clockNumMat(2,itxt)+center(1,2)-7, redLut, wRGB);
end
if iFrames == clFrmStart
beep;
end
if iFrames > clFrmStart-1 && iFrames < clFrmStart + handInt*clFrames+5
count = count+1;
Screen('DrawLine', window, redLut, xcent, ycent, handx(count), handy(count), 2.5);
end
vbl = Screen('Flip', window, secs0 + (waitframes - 0.5) * ifi);
Screen('DrawingFinished', window); % tell psychtoolbox drawing is finished, should help timing
end
Priority(0);
% % % % while ~keypress
% % % % if CharAvail
% % % % userRes = input(' ');
% % % % keypress = 1;
% % % % end
% % % % end
% % % % FlushEvents('mouseDown','keyDown');
keyIsDown=0;
kbName=[];
Digit = [];
Nums = {'0','1','2','3','4','5','6','7','8','9'};
Screen('TextSize', window, 30);
commandwindow;
while keyIsDown==0 | (strcmp('ENTER',kbName)==0)% & strcmp('2',kbName)==0)
keyIsDown=0;
[keyIsDown, secs, keyCode] = KbCheck;
if keyIsDown==1 %
kbName = KbName(keyCode);
end
if Digit & any(strcmp(Nums(:),kbName))
idx=find(strcmp(Nums(:),kbName))
NumPressed = Nums{idx}
kbName = strcat(firstDigit,NumPressed)
userRes = kbName
% DrawFormattedText(window, kbName, 'center', 'center', color);
DrawFormattedText(window, kbName, 400, 512, redLut);
Screen('Flip', window);
kbName = [];
Digit = 0;
WaitSecs(.4);
elseif any(strcmp(Nums(:),kbName))
idx=find(strcmp(Nums(:),kbName));
NumPressed = Nums{idx};
userRes = kbName;
%-si es numero -- llevarlo a la pantalla
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
Digit = 1 ;% flag to mean that
firstDigit = kbName;
WaitSecs(.4);
kbName = [];
end
if strcmp('DELETE',kbName)==1 %-si es el backspace --limpiar numero
kbName = []% ;
userRes = kbName
firstDigit = [];
Digit = 0;
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
%else % -si no es numero -- ignorar
WaitSecs(.4);
end
end %end while
% userRes = num2str(2);
AfterResp = 'OK'
Screen('TextSize', window, 14);
FlushEvents('mouseDown','keyDown');
aa = cd('/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/A Outputs');
% aa = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\A Outputs')
cd
WaitSecs(.2)
%
fprintf(fp, '%s\t%i/%i/%i %i:%i:%i\t%1.3f\t%1.3f\t%i\t%i\t%i\t%s\n',...
subName, time(2), time(3), time(1), time(4), time(5), round(time(6)), hfpRG, hfpBG, cont(iCont), curr_cond(iCond), randStrt+5, userRes);
a = cd('/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/4 AfterImage'); %
% a = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\4 AfterImage'); %
cd
WaitSecs(.2)
%ListenChar(0)
Screen('FillRect', window, wRGB, windowRect);
Screen('Flip', window);
clear secHandCord colLut
TrialCount = TrialCount+1
end %ICond
end %iCont
end %iRep
fclose(fp);
sca
end

610
002 After Image GUI Project/AfIm_Exp_old.m

@ -0,0 +1,610 @@
function AfIm_Exp_old(subName,numRep,maxLum,white,curr_cond)
% Check that Psychtoolbox is properly installed, switch to unified KbName's
% across operating systems, and switch color range to normalized 0 - 1 range:
PsychDefaultSetup(2);
theDate = fix(clock);
saveFile = sprintf('%s_afterimage', subName)
a = '/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/4 AfterImage' ;% folder where the program is.
fp = fopen(saveFile, 'at');
%% Color information, load hfp data and color calibration
aa = cd('/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/A Outputs');
hfpFile = sprintf('%sHFP', subName);
load(hfpFile, '-mat')
hfpRG = rg_avg;
hfpBG = bg_avg;
cd(a); % return to program folder.
load colorCalFile1.mat
fprintf('\nLast calibration was %s\n', describe.date);
pix = pix/1001;
cd(aa) ;% output folder
aa = cd('/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/A Outputs');
% aa = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\A Outputs')
% maxLum = 20; %cd/m^2
contFile = sprintf('%s_ContMatch', subName);
cd
load(contFile, '-mat')
lCont = fliplr(Final_lCont_avg);% sort the matrix in descendent order
lumMod = fliplr(Final_lumMod_avg);
sCont = [.8 .65 .5 .35];
numCont = 4;
% white = [.665 1];
blackLut = [0 0 0];
redLut = [.8 0 0];
%% set up psych toolbox
%set up 10 bit color
PsychImaging('PrepareConfiguration');
%PsychImaging('AddTask', 'General', 'EnableNative10BitFrameBuffer',1); %the 0 is turn off dithering?
expScreen = 1;
%create white LUT
cd(a);
wLMS(1,1) = white(1,1)*maxLum;
wLMS(1,2) = (1-white(1,1))*maxLum;
wLMS(1,3) = white(1,2)*maxLum;
wXYZ(1,:) = LMS_to_XYZ(wLMS(1,:));
wRGB(1,:) = XYZ_to_RGB(wXYZ(1,:), maxPhosXYZ);
wRGB(1,1) = pix(dsearchn(redProp(:), wRGB(1,1)))*hfpRG;
wRGB(1,2) = pix(dsearchn(grnProp(:), wRGB(1,2)));
wRGB(1,3) = pix(dsearchn(blueProp(:), wRGB(1,3)))*hfpBG;
[window, windowRect] = PsychImaging('OpenWindow', expScreen, wRGB, [], [], []); %
%Screen('OpenWindow',0, [0 0 0]); %makes main screen dark
%PsychImaging('OpenWindow', expScreen, wRGB);
[xcent,ycent] = RectCenter(windowRect);
center = [xcent ycent];
%% TIMING
%find frames per second
ifi = Screen('GetFlipInterval', window);% Measure the vertical refresh rate of the monitor
topPriorityLevel = MaxPriority(window);% Retreive the maximum priority number
numSecs = 16; %in seconds, total presentation time
framesPerSec = round(1/ifi);
nFrames = numSecs * framesPerSec;
waitframes = 1; %number of frames to wait between refresh
% color changed .03 of full cycle per second - finished 1/2 cycle in 16 seconds, 1/32
%in Zaidi, clock face appears at 10.15 seconds, will approximate this
%number
zaidiClock = 10.15; %is when Zaidi started in his example.
clFrmStart = floor(1/ifi*zaidiClock);
clTotTime = 2.9*2; %how long is clock in the screen
handInt = 12*2; %how many places to stop around the clock
clFrames = floor(clTotTime/handInt/ifi); %this will move the hand 15 degrees at a time, and decides how many frames to sit at each angle
%% Stimulus Size Parameters
circleDeg = 3.6;
clockPt = 0.1;
% code assumes 1 pixel = 1 arc min
pixPerDeg = 35; %at a distance of 57 cm
circlePix = circleDeg*pixPerDeg;
clockPix = clockPt*pixPerDeg;
tstcircle = [xcent - circlePix/2 ycent - circlePix/2 xcent + circlePix/2 ycent + circlePix/2];
%create circular grid for clock face and the numbers
rad = circleDeg/2*pixPerDeg; %circlePix/2-pixPerDeg/2;
radNum = (circleDeg/2) * pixPerDeg;
clockDegs = [1:15:360];
for iC = 1:length(clockDegs)
[xcFace(iC), ycFace(iC)] = pol2cart(clockDegs(iC)*pi/180, rad);
[xcNumber(iC), ycNumber(iC)] = pol2cart(clockDegs(iC)*pi/180, radNum);
end
%create matrix of dot locations
clockPosMat = [reshape(xcFace,1, length(clockDegs)); reshape(ycFace,1, length(clockDegs))];
clockNumMat = [reshape(xcNumber,1, length(clockDegs)); reshape(ycNumber,1, length(clockDegs))];
Screen('TextSize', window, 14);
textOne = [6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 2 3 4 5];
yPositionIsBaseline=1;
%create array of second hand positions to index
count = 1;
secHandCord(1:handInt) = (1:15:360)*(pi/180);
for iMove = 1:length(secHandCord)
secHandMove(count:count+clFrames-1) = secHandCord(iMove);
count = count+clFrames;
end
secHandMove(length(secHandMove)+1:length(secHandMove)*2) = secHandMove(1:length(secHandMove));
% numRep = 3; %number of times to repeat the experiment
WaitSecs(5);
%practice
for iprac = 1
FlushEvents('mouseDown','keyDown');
%create colors depending on contrast
l = [white(1)+(white(1)*lCont(1)) 1 maxLum
white(1)-(white(1)*lCont(1)) 1 maxLum]; %+l, -l
s = [white(1) white(2)+(white(2)*sCont(1)) maxLum
white(1) white(2)-(white(2)*sCont(1)) maxLum];%+s, -s
forFive = [white(1)+(white(1)*lCont(1)) white(2)+(white(2)*sCont(1)) maxLum
white(1)-(white(1)*lCont(1)) white(2)-(white(2)*sCont(1)) maxLum];
oneThrFive = [white(1)-(white(1)*lCont(1)) white(2)+(white(2)*sCont(1)) maxLum
white(1)+(white(1)*lCont(1)) white(2)-(white(2)*sCont(1)) maxLum];
lum = [white(1) white(2) maxLum-lumMod(1)
white(1) white(2) maxLum+lumMod(1)];
lum_l_45 = [white(1)+(white(1)*lCont(1)) white(2) maxLum+lumMod(1)
white(1)-(white(1)*lCont(1)) white(2) maxLum-lumMod(1)];
lum_l_135 = [white(1)+(white(1)*lCont(1)) white(2) maxLum-lumMod(1)
white(1)-(white(1)*lCont(1)) white(2) maxLum+lumMod(1)];
lum_s_45 = [white(1) white(2)+(white(2)*sCont(1)) maxLum+lumMod(1)
white(1) white(2)-(white(2)*sCont(1)) maxLum-lumMod(1)];
lum_s_135 = [white(1) white(2)+(white(2)*sCont(1)) maxLum-lumMod(1)
white(1) white(2)-(white(2)*sCont(1)) maxLum+lumMod(1)];
% cond = randperm(1);
cond = 1:9
rnd_idx = randperm(length(curr_cond));
curr_cond = curr_cond(rnd_idx)
% Cond = Cond(curr_cond_rnd) ;
for iCond = 1:length(curr_cond)
%create table of color changes
switch curr_cond(iCond)
case 1
colLut = l;
case 2
colLut = s;
case 3
colLut = forFive;
case 4
colLut = oneThrFive;
case 5
colLut = lum;
case 6
colLut = lum_l_45;
case 7
colLut = lum_l_135;
case 8
colLut = lum_s_45;
case 9
colLut = lum_s_135;
% % % % % % % % case 2
% % % % % % % % colLut = TEST_lum_l;
end
%LMS values of each color, ls to LMS
for iLMS = 1:2
cLMS(iLMS,1) = colLut(iLMS,1)*colLut(iLMS, 3);
cLMS(iLMS,2) = (1-colLut(iLMS,1))*colLut(iLMS, 3);
cLMS(iLMS,3) = colLut(iLMS,2)*colLut(iLMS, 3);
end
%XYZ values for each
for iXYZ = 1:length(cLMS(:,1))
cXYZ(iXYZ,:) = LMS_to_XYZ(cLMS(iXYZ,:));
end
%use lut to find corrected monitor RGB values for each rgb color
for iRGB = 1:length(cXYZ(:,1))
cRGB(iRGB,:) = XYZ_to_RGB(cXYZ(iRGB,:), maxPhosXYZ);
cRGB(iRGB,1) = pix(dsearchn(redProp(:), cRGB(iRGB,1)))*hfpRG;
cRGB(iRGB,2) = pix(dsearchn(grnProp(:), cRGB(iRGB,2)));
cRGB(iRGB,3) = pix(dsearchn(blueProp(:), cRGB(iRGB,3)))*hfpBG;
end
rampLeft = zeros(nFrames,3);
rampRight = zeros(nFrames,3);
for iRamp = 1:3 %for 3 phosophors
rampLeft(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(1,iRamp), nFrames);
rampRight(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(2,iRamp), nFrames);
end
%create random start point for clock hand
randStrt = randi(handInt-1); %won't pick midnight as start point due to second hand array not being long enough
%clock set to go around 1 full circle
for ihand = 1:handInt*clFrames+clFrames
th(ihand) = (secHandMove(randStrt*clFrames-clFrames+ihand));
[handx(ihand), handy(ihand)] = pol2cart(th(ihand),rad);
end
handx = handx + xcent;
handy = handy + ycent;
WaitSecs(3); %a short adaptation before the next trial
keypress = 0;
count = 0; %for clock hand
Priority(topPriorityLevel);
FlushEvents('mouseDown','keyDown');
%ListenChar(2)
secs0 = Screen('Flip', window);
for iFrames = 1:nFrames
Screen('FillArc', window, rampLeft(iFrames,:), tstcircle, 0, 180);
Screen('FillArc', window, rampRight(iFrames,:), tstcircle, 180, 180);
Screen('DrawDots', window, clockPosMat,clockPix, redLut, center, 2);
Screen('DrawDots', window, [0 0],clockPix, 0, center, 2); % black dot for fixation
Screen('DrawText', window, 'Pr', 20, 20, redLut, wRGB);
for itxt = 1:24
textNum = sprintf('%i', textOne(itxt));
Screen('DrawText', window, textNum, 1.18*clockNumMat(1,itxt)+center(1,1)-7, 1.18*clockNumMat(2,itxt)+center(1,2)-7, redLut, wRGB);
end
if iFrames == clFrmStart
beep;
end
if iFrames > clFrmStart-1 && iFrames < clFrmStart + handInt*clFrames+5
count = count+1;
Screen('DrawLine', window, redLut, xcent, ycent, handx(count), handy(count), 2.5);
end
vbl = Screen('Flip', window, secs0 + (waitframes - 0.5) * ifi);
Screen('DrawingFinished', window); % tell psychtoolbox drawing is finished, should help timing
end
Priority(0);
keyIsDown=0;
kbName=[];
Digit = [];
Nums = {'0','1','2','3','4','5','6','7','8','9'};
Screen('TextSize', window, 30);
commandwindow;
while keyIsDown==0 | (strcmp('ENTER',kbName)==0)% & strcmp('2',kbName)==0)
keyIsDown=0;
[keyIsDown, secs, keyCode] = KbCheck;
if keyIsDown==1 %
kbName = KbName(keyCode);
end
if Digit & any(strcmp(Nums(:),kbName))
idx=find(strcmp(Nums(:),kbName));
NumPressed = Nums{idx};
kbName = strcat(firstDigit,NumPressed);
userRes = kbName;
% DrawFormattedText(window, kbName, 'center', 'center', color);
DrawFormattedText(window, kbName, 400, 512, redLut);
Screen('Flip', window);
kbName = [];
Digit = 0;
WaitSecs(.4);
elseif any(strcmp(Nums(:),kbName))
idx=find(strcmp(Nums(:),kbName));
NumPressed = Nums{idx};
userRes = kbName;
%-si es numero -- llevarlo a la pantalla
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
Digit = 1 ;% flag to mean that
firstDigit = kbName;
WaitSecs(.4);
kbName = [];
end
if strcmp('DELETE',kbName)==1 %-si es el backspace --limpiar numero
kbName = []% ;
userRes = kbName;
firstDigit = [];
Digit = 0;
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
WaitSecs(.4);
%else % -si no es numero -- ignorar
end
end %end while
userRes
Screen('TextSize', window, 14);
FlushEvents('mouseDown','keyDown');
aa = cd('/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/A Outputs');
% aa = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\A Outputs')
cd
WaitSecs(.2)
% time = clock;
% fprintf(fp, '%s\t%i/%i/%i %i:%i:%i\t%1.3f\t%1.3f\t%i\t%i\t%s\t%i\tPractice\n',...
% subName, time(2), time(3), time(1), time(4), time(5), round(time(6)), hfpRG, hfpBG, 1, cond(iCond), randStrt+5, userRes);
time = clock;
fprintf(fp, '%s\t%i/%i/%i %i:%i:%i\t%1.3f\t%1.3f\t%i\t%i\t%i\t%s\tPractice\n',...
subName, time(2), time(3), time(1), time(4), time(5), round(time(6)), hfpRG, hfpBG, 1,curr_cond(iCond), randStrt, userRes);
a = cd('/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/4 AfterImage'); %
% a = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\4 AfterImage'); %
cd
WaitSecs(.2)
%ListenChar(0)
Screen('FillRect', window, wRGB, windowRect);
Screen('Flip', window);
clear secHandCord colLut
end
end
clear iCond
TrialCount = 1;
%run experiment
for iRep = 1:numRep
cont = randperm(numCont); %randomize contrast conditions
for iCont = 1:numCont
FlushEvents('mouseDown','keyDown');
%create colors with depending on contrast
l = [white(1)+(white(1)*lCont(cont(iCont))) white(2) maxLum
white(1)-(white(1)*lCont(cont(iCont))) white(2) maxLum]; %+l, -l
s = [white(1) white(2)+(white(2)*sCont(cont(iCont))) maxLum
white(1) white(2)-(white(2)*sCont(cont(iCont))) maxLum];%+s, -s
forFive = [white(1)+(white(1)*lCont(cont(iCont))) white(2)+(white(2)*sCont(cont(iCont))) maxLum
white(1)-(white(1)*lCont(cont(iCont))) white(2)-(white(2)*sCont(cont(iCont))) maxLum];
oneThrFive = [white(1)-(white(1)*lCont(cont(iCont))) white(2)+(white(2)*sCont(cont(iCont))) maxLum
white(1)+(white(1)*lCont(cont(iCont))) white(2)-(white(2)*sCont(cont(iCont))) maxLum];
lum = [white(1) white(2) maxLum-lumMod(cont(iCont))
white(1) white(2) maxLum+lumMod(cont(iCont))];
lum_l_45 = [white(1)+(white(1)*lCont(iCont)) white(2) maxLum+lumMod(iCont)
white(1)-(white(1)*lCont(iCont)) white(2) maxLum-lumMod(iCont)];
lum_l_135 = [white(1)+(white(1)*lCont(iCont)) white(2) maxLum-lumMod(iCont)
white(1)-(white(1)*lCont(iCont)) white(2) maxLum+lumMod(iCont)];
lum_s_45 = [white(1) white(2)+(white(2)*sCont(iCont)) maxLum+lumMod(iCont)
white(1) white(2)-(white(2)*sCont(iCont)) maxLum-lumMod(iCont)];
lum_s_135 = [white(1) white(2)+(white(2)*sCont(iCont)) maxLum-lumMod(iCont)
white(1) white(2)-(white(2)*sCont(iCont)) maxLum+lumMod(iCont)];
% cond = 1:9
rnd_idx = randperm(length(curr_cond));
curr_cond = curr_cond(rnd_idx)
% Cond = Cond(curr_cond_rnd) ;
for iCond = 1:length(curr_cond)
%create table of color changes
switch curr_cond(iCond)
% cond = randperm(9);
% for iCond = 1:9
%create table of color changes
% switch cond(iCond)
case 1
colLut = l;
case 2
colLut = s;
case 3
colLut = forFive;
case 4
colLut = oneThrFive;
case 5
colLut = lum;
case 6
colLut = lum_l_45;
case 7
colLut = lum_l_135;
case 8
colLut = lum_s_45;
case 9
colLut = lum_s_135;
end
%LMS values of each color, ls to LMS
for iLMS = 1:2
cLMS(iLMS,1) = colLut(iLMS,1)*colLut(iLMS, 3);
cLMS(iLMS,2) = (1-colLut(iLMS,1))*colLut(iLMS, 3);
cLMS(iLMS,3) = colLut(iLMS,2)*colLut(iLMS, 3);
end
%XYZ values for each
for iXYZ = 1:length(cLMS(:,1))
cXYZ(iXYZ,:) = LMS_to_XYZ(cLMS(iXYZ,:));
end
%use lut to find corrected monitor RGB values for each rgb color
for iRGB = 1:length(cXYZ(:,1))
cRGB(iRGB,:) = XYZ_to_RGB(cXYZ(iRGB,:), maxPhosXYZ);
cRGB(iRGB,1) = pix(dsearchn(redProp(:), cRGB(iRGB,1)))*hfpRG;
cRGB(iRGB,2) = pix(dsearchn(grnProp(:), cRGB(iRGB,2)));
cRGB(iRGB,3) = pix(dsearchn(blueProp(:), cRGB(iRGB,3)))*hfpBG;
end
rampLeft = zeros(nFrames,3);
rampRight = zeros(nFrames,3);
for iRamp = 1:3 %for 3 phosophors
rampLeft(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(1,iRamp), nFrames);
rampRight(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(2,iRamp), nFrames);
end
%create random start point for clock hand
randStrt = randi(handInt-1); %won't pick midnight as start point due to second hand array not being long enough
%clock set to go around 1 full circle
for ihand = 1:handInt*clFrames+clFrames
th(ihand) = (secHandMove(randStrt*clFrames-clFrames+ihand));
[handx(ihand), handy(ihand)] = pol2cart(th(ihand),rad);
end
handx = handx + xcent;
handy = handy + ycent;
WaitSecs(5); %a short adaptation before the next trial
keypress = 0;
count = 0; %for clock hand
TrialCountStr = num2str(TrialCount);
Priority(topPriorityLevel);
FlushEvents('mouseDown','keyDown');
%ListenChar(2)
secs0 = Screen('Flip', window);
for iFrames = 1:nFrames
Screen('FillArc', window, rampLeft(iFrames,:), tstcircle, 0, 180);
Screen('FillArc', window, rampRight(iFrames,:), tstcircle, 180, 180);
Screen('DrawDots', window, clockPosMat,clockPix, redLut, center, 2);
Screen('DrawDots', window, [0 0],clockPix, 0, center, 2); % black dot for fixation
Screen('DrawText', window, TrialCountStr, 20, 20, redLut, wRGB);
for itxt = 1:24
textNum = sprintf('%i', textOne(itxt));
Screen('DrawText', window, textNum, 1.18*clockNumMat(1,itxt)+center(1,1)-7, 1.18*clockNumMat(2,itxt)+center(1,2)-7, redLut, wRGB);
end
if iFrames == clFrmStart
beep;
end
if iFrames > clFrmStart-1 && iFrames < clFrmStart + handInt*clFrames+5
count = count+1;
Screen('DrawLine', window, redLut, xcent, ycent, handx(count), handy(count), 2.5);
end
vbl = Screen('Flip', window, secs0 + (waitframes - 0.5) * ifi);
Screen('DrawingFinished', window); % tell psychtoolbox drawing is finished, should help timing
end
Priority(0);
% % % % while ~keypress
% % % % if CharAvail
% % % % userRes = input(' ');
% % % % keypress = 1;
% % % % end
% % % % end
% % % % FlushEvents('mouseDown','keyDown');
keyIsDown=0;
kbName=[];
Digit = [];
Nums = {'0','1','2','3','4','5','6','7','8','9'};
Screen('TextSize', window, 30);
commandwindow;
while keyIsDown==0 | (strcmp('ENTER',kbName)==0)% & strcmp('2',kbName)==0)
keyIsDown=0;
[keyIsDown, secs, keyCode] = KbCheck;
if keyIsDown==1 %
kbName = KbName(keyCode);
end
if Digit & any(strcmp(Nums(:),kbName))
idx=find(strcmp(Nums(:),kbName))
NumPressed = Nums{idx}
kbName = strcat(firstDigit,NumPressed)
userRes = kbName
% DrawFormattedText(window, kbName, 'center', 'center', color);
DrawFormattedText(window, kbName, 400, 512, redLut);
Screen('Flip', window);
kbName = [];
Digit = 0;
WaitSecs(.4);
elseif any(strcmp(Nums(:),kbName))
idx=find(strcmp(Nums(:),kbName));
NumPressed = Nums{idx};
userRes = kbName;
%-si es numero -- llevarlo a la pantalla
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
Digit = 1 ;% flag to mean that
firstDigit = kbName;
WaitSecs(.4);
kbName = [];
end
if strcmp('DELETE',kbName)==1 %-si es el backspace --limpiar numero
kbName = []% ;
userRes = kbName
firstDigit = [];
Digit = 0;
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
%else % -si no es numero -- ignorar
WaitSecs(.4);
end
end %end while
% userRes = num2str(2);
AfterResp = 'OK'
Screen('TextSize', window, 14);
FlushEvents('mouseDown','keyDown');
aa = cd('/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/A Outputs');
% aa = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\A Outputs')
cd
WaitSecs(.2)
%
fprintf(fp, '%s\t%i/%i/%i %i:%i:%i\t%1.3f\t%1.3f\t%i\t%i\t%i\t%s\n',...
subName, time(2), time(3), time(1), time(4), time(5), round(time(6)), hfpRG, hfpBG, cont(iCont), curr_cond(iCond), randStrt+5, userRes);
a = cd('/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/4 AfterImage'); %
% a = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\4 AfterImage'); %
cd
WaitSecs(.2)
%ListenChar(0)
Screen('FillRect', window, wRGB, windowRect);
Screen('Flip', window);
clear secHandCord colLut
TrialCount = TrialCount+1
end %ICond
end %iCont
end %iRep
fclose(fp);
sca
end

608
002 After Image GUI Project/AfIm_NOclock_Exp.m

@ -0,0 +1,608 @@
function AfIm_NOclock_Exp(subName,meanLum,Bckg_Chro,axis_chck,AdaptTime,nRep,OneHemi_chck,Simu_chck)
Clock = 1;
%%%%%%%%%%%%%%%%
% ARDUINO and CAMERA settings
Cam_freq = 240 ; % square waves freq
Cam_RECduration = 30; %in seconds. (30secs is the maximal time allowed by Matlab to play tone in arduino board)
ard = arduino; % open arduino
%%%%%%%%%%%%%%%
try
assignin('base','Stop_Press',0)% this works for the STOP experiment button
% Check that Psychtoolbox is properly installed, switch to unified KbName's
% across operating systems, and switch color range to normalized 0 - 1 range:
PsychDefaultSetup(2);
saveFile = sprintf('%s_afterimage', subName)
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
fp = fopen(saveFile, 'at');
%% Color information, load hfp data and color calibration
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
hfpFile = sprintf('%sHFP', subName);
load(hfpFile, '-mat')
hfpRG = rg_avg;
hfpBG = bg_avg;
% cd(a); % return to program folder.
Calib_Dire = cd('/Users/clemente/Desktop/AfterImage Programs/002 After Image GUI Project');
load colorCalFile1.mat
fprintf('\nLast calibration was %s\n', describe.date)
pix = pix/1001;
cd(aa) ;% output folder
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
% aa = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\A Outputs')
% maxLum = 20; %cd/m^2
contFile = sprintf('%s_ContMatch', subName);
cd
load(contFile, '-mat')
% % % % lCont = fliplr(Final_lCont_avg);% sort the matrix in descendent order
% % % % lumMod = fliplr(Final_lumMod_avg);
% % % %
% % % % sCont = [.8 .65 .5 .35];
% % % % nCont = 4;
% lCont = Final_lCont_avg(:,4:5);
% lumMod = Final_lumMod_avg(:,4:5);
% sCont = [.5 .65
% .5 .65
% .5 .65
% .5 .65];
%
% nCont = 2;
% lCont = Final_lCont_avg(3:6);
% lumMod = Final_lumMod_avg(3:6);
% sCont = [.5 .65
% .5 .65
% .5 .65
% .5 .65];
% sCont = Final_sCont_ref;
lCont = Final_lCont_avg;
lumMod = Final_lumMod_avg;
sCont = Final_sCont_ref;
nCont = size(sCont,2);
nBckg_Chro = size(Bckg_Chro,1);
% white = [.665 1];
blackLut = [0 0 0];
redLut = [.8 0 0];
% Bckg_Chro = Final_lCont_avg(:,1:2)
%% Save Session Information
theDate = fix(clock);
% a = '/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/4 ColBackg AI' ;% folder where the program is.
infoFile = sprintf('%s_SessionsInfo', subName)
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs'); ;% folder where the program is.
checkfile = exist(infoFile, 'file')
fo = fopen(infoFile, 'at')
if checkfile == 0 % if file doesn't exist, then print the following header:
fprintf(fo,'Subject\t Date\t Time\t Lum\t nBckg_Chro\t nCont\t nRep\t l_\t s_\t lum_\t ls45\t ls135\t luml45\t luml135\t lums45\t luml135\n')
end
% fo = fopen(infoFile, 'at')
fprintf(fo, '%s\t%i/%i/%i %i:%i:%i\t %1.2f\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\n',...
subName, theDate(2), theDate(3), theDate(1), theDate(4), theDate(5), round(theDate(6)),...
meanLum, nBckg_Chro, nCont, nRep,axis_chck(1),axis_chck(2),...
axis_chck(3),axis_chck(4) ,axis_chck(5),axis_chck(6),...
axis_chck(7),axis_chck(8),axis_chck(9));
% % % % fprintf(fo, '%s\t%i/%i/%i %i:%i:%i\t %1.2f\t%1.3f\t%1.3f\t%i\n',...
% % % % subName, theDate(2), theDate(3), theDate(1), theDate(4), theDate(5), round(theDate(6)),...
% % % % maxLum, white(1),white(2), nRep)%,curr_cond(1),curr_cond(2),...
% % % % % % curr_cond(3),curr_cond(4) ,curr_cond(5),curr_cond(6),...
% % % % % % curr_cond(7),curr_cond(8),curr_cond(9));
fclose(fo)
%% set up psych toolbox
%set up 10 bit color
PsychImaging('PrepareConfiguration');
%PsychImaging('AddTask', 'General', 'EnableNative10BitFrameBuffer',1); %the 0 is turn off dithering?
expScreen = 1;
%create white LUT
cd(a);
% % % wLMS(1,1) = white(1,1)*maxLum;
% % % wLMS(1,2) = (1-white(1,1))*maxLum;
% % % wLMS(1,3) = white(1,2)*maxLum;
% % % wXYZ(1,:) = LMS_to_XYZ(wLMS(1,:));
% % % wRGB(1,:) = XYZ_to_RGB(wXYZ(1,:), maxPhosXYZ);
% % % wRGB(1,1) = pix(dsearchn(redProp(:), wRGB(1,1)))*hfpRG;
% % % wRGB(1,2) = pix(dsearchn(grnProp(:), wRGB(1,2)));
% % % wRGB(1,3) = pix(dsearchn(blueProp(:), wRGB(1,3)))*hfpBG;
[window, windowRect] = PsychImaging('OpenWindow', expScreen, [0 0 0], [], [], []); % Set a black screen before starting
%Screen('OpenWindow',0, [0 0 0]); %makes main screen dark
%PsychImaging('OpenWindow', expScreen, wRGB);
[xcent,ycent] = RectCenter(windowRect);
center = [xcent ycent];
%% TIMING
%find frames per second
ifi = Screen('GetFlipInterval', window);% Measure the vertical refresh rate of the monitor
topPriorityLevel = MaxPriority(window);% Retreive the maximum priority number
numSecs = 16; %in seconds, total presentation time
framesPerSec = round(1/ifi);
nFrames = numSecs * framesPerSec;
waitframes = 1; %number of frames to wait between refresh
% color changed .03 of full cycle per second - finished 1/2 cycle in 16 seconds, 1/32
%in Zaidi, clock face appears at 10.15 seconds, will approximate this
%number
zaidiClock = 10.15; %is when Zaidi started in his example.
clFrmStart = floor(1/ifi*zaidiClock);
clTotTime = 2.9*2; %how long is clock in the screen
handInt = 12*2; %how many places to stop around the clock
clFrames = floor(clTotTime/handInt/ifi); %this will move the hand 15 degrees at a time, and decides how many frames to sit at each angle
ISI = 20;
%% Stimulus Size Parameters
circleDeg = 7.2;
clockPt = 0.1;
% code assumes 1 pixel = 1 arc min
pixPerDeg = 35; %at a distance of 57 cm
circlePix = circleDeg*pixPerDeg;
clockPix = clockPt*pixPerDeg;
tstcircle = [xcent - circlePix/2 ycent - circlePix/2 xcent + circlePix/2 ycent + circlePix/2];
%create circular grid for clock face and the numbers
% % % circleDegGrid = 2 ;
% % % rad = circleDegGrid/2*pixPerDeg; %circlePix/2-pixPerDeg/2;
rad = circleDeg/2*pixPerDeg; %circlePix/2-pixPerDeg/2;
radNum = (circleDeg/2) * pixPerDeg;
clockDegs = [1:15:360];
for iC = 1:length(clockDegs)
[xcFace(iC), ycFace(iC)] = pol2cart(clockDegs(iC)*pi/180, rad);
[xcNumber(iC), ycNumber(iC)] = pol2cart(clockDegs(iC)*pi/180, 1*radNum);
end
%create matrix of dot locations
clockPosMat = [reshape(xcFace,1, length(clockDegs)); reshape(ycFace,1, length(clockDegs))];
clockNumMat = [reshape(xcNumber,1, length(clockDegs)); reshape(ycNumber,1, length(clockDegs))];
Screen('TextSize', window, 14);
textOne = [6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 2 3 4 5];
yPositionIsBaseline=1;
%create array of second hand positions to index
count = 1;
secHandCord(1:handInt) = (1:15:360)*(pi/180);
for iMove = 1:length(secHandCord)
secHandMove(count:count+clFrames-1) = secHandCord(iMove);
count = count+clFrames;
end
secHandMove(length(secHandMove)+1:length(secHandMove)*2) = secHandMove(1:length(secHandMove));
WaitSecs(1);
%%/////////////////////////////////////////////////////////////////////////
%%///////////////////////// EXPERIMENT TRIALS /////////////////////////////
%%/////////////////////////////////////////////////////////////////////////
clear iCond
curr_axis = find(axis_chck)
%run experiment
TrialCount = 1;
Card_Dir = 0;
for iChro = 1:size(Bckg_Chro,1)
wLMS(1,1) = Bckg_Chro(iChro,1)*meanLum;
wLMS(1,2) = (1-Bckg_Chro(iChro,1))*meanLum;
wLMS(1,3) = Bckg_Chro(iChro,2)*meanLum;
wXYZ(1,:) = LMS_to_XYZ(wLMS(1,:));
wRGB(1,:) = XYZ_to_RGB(wXYZ(1,:), maxPhosXYZ);
wRGB(1,1) = pix(dsearchn(redProp(:), wRGB(1,1)))*hfpRG;
wRGB(1,2) = pix(dsearchn(grnProp(:), wRGB(1,2)));
wRGB(1,3) = pix(dsearchn(blueProp(:), wRGB(1,3)))*hfpBG;
commandwindow;
Speak(' Press any key when you are ready');
KbStrokeWait;
% Adaptation screen
Screen('FillRect', window, wRGB);
Screen('DrawDots', window, [0 0],clockPix, 0, center, 2); % black dot for fixation
Screen('Flip',window)
WaitSecs(AdaptTime)
for iRep = 1:nRep
cont = randperm(nCont); %randomize contrast conditions
for iCont = 1:nCont
FlushEvents('mouseDown','keyDown');
%create colors with depending on contrast
l = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum]; %+l, -l
s = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum];%+s, -s
lum = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2) meanLum-lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2) meanLum+lumMod(iChro,cont(iCont))]; % -lum , +lum
l_s_45 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum];
l_s_135 = [Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum
Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum];
lum_l_45 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum+lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum-lumMod(iChro,cont(iCont))];
lum_l_135 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum-lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum+lumMod(iChro,cont(iCont))];
lum_s_45 = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum+lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum-lumMod(iChro,cont(iCont))];
lum_s_135 = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum-lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum+lumMod(iChro,cont(iCont))];
rnd_idx = randperm(length(curr_axis));
curr_axis = curr_axis(rnd_idx)
% cond = randperm(9);
for iCond = 1:length(curr_axis)
%create table of color changes
switch curr_axis(iCond)
case 1
colLut = l;
case 2
colLut = s;
case 3 %%%% ATENCION que ahora LUM es la condicion 3
colLut = lum;
case 4
colLut = l_s_45;
case 5
colLut = l_s_135;
case 6
colLut = lum_l_45;
case 7
colLut = lum_l_135;
case 8
colLut = lum_s_45;
case 9
colLut = lum_s_135;
end
%LMS values of each color, ls to LMS
for iLMS = 1:2
cLMS(iLMS,1) = colLut(iLMS,1)*colLut(iLMS, 3);
cLMS(iLMS,2) = (1-colLut(iLMS,1))*colLut(iLMS, 3);
cLMS(iLMS,3) = colLut(iLMS,2)*colLut(iLMS, 3);
end
%XYZ values for each
for iXYZ = 1:length(cLMS(:,1))
cXYZ(iXYZ,:) = LMS_to_XYZ(cLMS(iXYZ,:));
end
%use lut to find corrected monitor RGB values for each rgb color
for iRGB = 1:length(cXYZ(:,1))
cRGB(iRGB,:) = XYZ_to_RGB(cXYZ(iRGB,:), maxPhosXYZ);
cRGB(iRGB,1) = pix(dsearchn(redProp(:), cRGB(iRGB,1)))*hfpRG;
cRGB(iRGB,2) = pix(dsearchn(grnProp(:), cRGB(iRGB,2)));
cRGB(iRGB,3) = pix(dsearchn(blueProp(:), cRGB(iRGB,3)))*hfpBG;
end
rampLeft = zeros(nFrames,3);
rampRight = zeros(nFrames,3);
for iRamp = 1:3 %for 3 phosophors
rampLeft(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(1,iRamp), nFrames);
rampRight(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(2,iRamp), nFrames);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% loadCombined =1;
% if loadCombined
% rampLeft = importdata('rampLeft_Combined.mat');
% rampRight = importdata('rampRight_Combined.mat');
% end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%create random start point for clock hand
randStrt = randi(handInt-1); %won't pick midnight as start point due to second hand array not being long enough
%clock set to go around 1 full circle
for ihand = 1:handInt*clFrames+clFrames
th(ihand) = (secHandMove(randStrt*clFrames-clFrames+ihand));
[handx(ihand), handy(ihand)] = pol2cart(th(ihand),1*rad);
end
handx = handx + xcent;
handy = handy + ycent;
%/////////////
switch OneHemi_chck
case 0 %if FullCircle
Dir = [1];
case 1
Dir = [2 -2]; %just one hemifield modulated
end
Dir_rnd = randperm(1);
for iDir = 1:1
Card_Dir = Dir(Dir_rnd(iDir));
switch Card_Dir
case {1,2}
ramp = rampLeft; % Increment
HF_posit = 0; % to place the hemifield in the LEFT position
case {-1,-2}
ramp = rampRight; % Decrement
HF_posit = 180; % to place the hemifield in the RIGHT position
end
%---------------------------
flatSound; % so the subject prepare for the stimulus
%%%%%%%%%%%%%%%%%%%%%%%%%
% START CAMERA RECORDING
playTone(ard,'D3',240,Cam_RECduration); %
%%%%%%%%%%%%%%%%%%%%
WaitSecs(4); %
keypress = 0;
count = 0; %for clock hand
TrialCountStr = num2str(TrialCount);
Priority(topPriorityLevel);
FlushEvents('mouseDown','keyDown');
%ListenChar(2)
secs0 = Screen('Flip', window);
for iFrames = 1:nFrames
% switch OneHemi_chck%if FullCircle
% case 0
%Full Circle
Screen('FillOval', window, ramp(iFrames,:), tstcircle );
% case 1
% % One Hemifield Modulated
% Screen('FillArc', window, ramp(iFrames,:), tstcircle, HF_posit, 180);
% end
% % % Screen('FillArc', window, rampLeft(iFrames,:), tstcircle, 0, 180);
% % % Screen('FillArc', window, rampRight(iFrames,:), tstcircle, 180, 180);
Screen('DrawDots', window, [0 0],clockPix, 0, center, 2); % black dot for fixation
if Clock %---------------------
Screen('DrawDots', window, clockPosMat,clockPix, blackLut, center, 2);
Screen('DrawText', window, TrialCountStr, 20, 20, redLut, wRGB);
for itxt = 1:24
textNum = sprintf('%i', textOne(itxt));
Screen('DrawText', window, textNum, 1.18*clockNumMat(1,itxt)+center(1,1)-7, 1.18*clockNumMat(2,itxt)+center(1,2)-7, blackLut, wRGB);
end
if iFrames == clFrmStart
beep;
end
if iFrames > clFrmStart-1 && iFrames < clFrmStart + handInt*clFrames+5
count = count+1;
Screen('DrawLine', window, redLut, xcent, ycent, handx(count), handy(count), 2.5);
end
end % Clock ---------------------
% % %-----------------
% % % PrintScreen of the monitor (for the paper)
% % % GetImage call. Alter the rect argument to change the location of the screen shot
% % imageArray = Screen('GetImage', window, [0 0 300 300]);
% % % imwrite is a Matlab function, not a PTB-3 function
% % imwrite(imageArray, 'test.jpg')
% % %------------------
vbl = Screen('Flip', window, secs0 + (waitframes - 0.5) * ifi);
Screen('DrawingFinished', window); % tell psychtoolbox drawing is finished, should help timing
end
Priority(0);
WaitSecs(10); % to tell the subject to blink normally
flatSound;
% Speak('Report Time')
% WaitSecs(5)% This is sumed to the ISI except for the last trial
% % % % while ~keypress
% % % % if CharAvail
% % % % userRes = input(' ');
% % % % keypress = 1;
% % % % end
% % % % end
% % % % FlushEvents('mouseDown','keyDown');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% RESPONSES %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if Clock
% if Simu_chck
% userRes = 'simu';
%
% else
keyIsDown=0;
kbName=[];
Digit = [];
Nums = {'0','1','2','3','4','5','6','7','8','9'};
Screen('TextSize', window, 30);
commandwindow;
while keyIsDown==0 | (strcmp('ENTER',kbName)==0)% & strcmp('2',kbName)==0)
keyIsDown=0;
[keyIsDown, secs, keyCode] = KbCheck;
if keyIsDown==1 %
kbName = KbName(keyCode);
end
if Digit & any(strcmp(Nums(:),kbName));
idx=find(strcmp(Nums(:),kbName));
NumPressed = Nums{idx};
kbName = strcat(firstDigit,NumPressed);
userRes = kbName;
% DrawFormattedText(window, kbName, 'center', 'center', color);
DrawFormattedText(window, kbName, 400, 512, redLut);
Screen('Flip', window);
kbName = [];
Digit = 0;
WaitSecs(.4);
elseif any(strcmp(Nums(:),kbName))
idx=find(strcmp(Nums(:),kbName));
NumPressed = Nums{idx};
userRes = kbName;
%-si es numero -- llevarlo a la pantalla
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
Digit = 1 ;% flag to mean that
firstDigit = kbName;
WaitSecs(.4);
kbName = [];
end
if strcmp('DELETE',kbName)==1 %-si es el backspace --limpiar numero
kbName = []% ;
userRes = kbName
firstDigit = [];
Digit = 0;
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
%else % -si no es numero -- ignorar
WaitSecs(.4);
end
end %end while
% end % end simu_chck
else
randStrt = 94;% it will be saved as 99
userRes = '99';
end % Clock
% userRes = num2str(2);
%
% AfterResp = 'OK'
Screen('TextSize', window, 14);
FlushEvents('mouseDown','keyDown');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SAVE %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
% aa = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\A Outputs')
cd
WaitSecs(.2)
time = clock;
% % fprintf(fp, '%s\t%i/%i/%i %i:%i:%i\t%1.3f\t%1.3f\t%1.3f\t%1.3f\t%i\t%i\t%i\t%i\tExperiment\n',...
% % subName, time(2), time(3), time(1), time(4), time(5), round(time(6)), hfpRG, hfpBG, Bckg_Chro(iChro,1), Bckg_Chro(iChro,2), cont(iCont), curr_axis(iCond), Card_Dir, userRes);
fprintf(fp, '%s\t%i/%i/%i %i:%i:%i\t%1.3f\t%1.3f\t%1.3f\t%1.3f\t%i\t%i\t%i\t%i\t%s\tExperiment\n',...
subName, time(2), time(3), time(1), time(4), time(5), round(time(6)), hfpRG, hfpBG, Bckg_Chro(iChro,1), Bckg_Chro(iChro,2), cont(iCont), curr_axis(iCond), Card_Dir, randStrt+5, userRes);
% a = cd('/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/4 ColBackg AI'); %
% a = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\4 AfterImage'); %
cd
WaitSecs(.2)
%ListenChar(0)
Screen('FillRect', window, wRGB, windowRect);
Screen('DrawDots', window, [0 0],clockPix, 0, center, 2); % black dot for fixation
Screen('Flip', window);
clear secHandCord colLut
TrialCount = TrialCount+1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% WANT TO STOP? %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% pause(3)
yesno=evalin('base','Stop_Press')
if yesno==1
return
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
WaitSecs(ISI); %
end % iDir
end %ICond
end %iCont
end %iRep
end %iChro
%%%%%%%%%%%%%%%%%%
% STOP CAMERA
Speak('Stop camera software');
WaitSecs(10);
writeDigitalPin(ard,'D3',1);
writeDigitalPin(ard,'D3',0);
%%%%%%%%%%%%%%%%%
fclose(fp);
sca
%create a matrix of seconds compared to pi values for each frame - just
%used in data analysis
% % % % piVSsecs(:,1) = [0:1/(nFrames-1):1];
% % % % piVSsecs(:,2) = [0:numSecs/(nFrames-1):numSecs];
catch
warndlg('The program failed to run. Try again.')
return
end
end

552
002 After Image GUI Project/AfIm_OneEnd_Exp.m

@ -0,0 +1,552 @@
function AfIm_OneEnd_Exp(subName,meanLum,Bckg_Chro,axis_chck,AdaptTime,nRep,OneHemi_chck,Simu_chck)
% Sti_Shape = 2 ;% 1 is the whole circle and 2 one hemifield
try
assignin('base','Stop_Press',0)% this works for the STOP experiment button
% Check that Psychtoolbox is properly installed, switch to unified KbName's
% across operating systems, and switch color range to normalized 0 - 1 range:
PsychDefaultSetup(2);
saveFile = sprintf('%s_afterimage', subName)
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
fp = fopen(saveFile, 'at');
%% Color information, load hfp data and color calibration
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
hfpFile = sprintf('%sHFP', subName);
load(hfpFile, '-mat')
hfpRG = rg_avg;
hfpBG = bg_avg;
% cd(a); % return to program folder.
Calib_Dire = cd('/Users/clemente/Desktop/AfterImage Programs/002 After Image GUI Project');
load colorCalFile1.mat
fprintf('\nLast calibration was %s\n', describe.date)
pix = pix/1001;
cd(aa) ;% output folder
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
% aa = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\A Outputs')
% maxLum = 20; %cd/m^2
contFile = sprintf('%s_ContMatch', subName);
cd
load(contFile, '-mat')
% % % % lCont = fliplr(Final_lCont_avg);% sort the matrix in descendent order
% % % % lumMod = fliplr(Final_lumMod_avg);
% % % %
% % % % sCont = [.8 .65 .5 .35];
% % % % nCont = 4;
% lCont = Final_lCont_avg(:,4:5);
% lumMod = Final_lumMod_avg(:,4:5);
% sCont = [.5 .65
% .5 .65
% .5 .65
% .5 .65];
%
% nCont = 2;
lCont = Final_lCont_avg;
lumMod = Final_lumMod_avg;
% sCont = [.5 .65
% .5 .65
% .5 .65
% .5 .65];
sCont = Final_sCont_ref;
nCont = size(sCont,2);
nBckg_Chro = size(Bckg_Chro,1);
% white = [.665 1];
blackLut = [0 0 0];
redLut = [.8 0 0];
% Bckg_Chro = Final_lCont_avg(:,1:2)
%% Save Session Information
theDate = fix(clock);
% a = '/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/4 ColBackg AI' ;% folder where the program is.
infoFile = sprintf('%s_SessionsInfo', subName)
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs'); ;% folder where the program is.
checkfile = exist(infoFile, 'file')
fo = fopen(infoFile, 'at')
if checkfile == 0 % if file doesn't exist, then print the following header:
fprintf(fo,'Subject\t Date\t Time\t Lum\t nBckg_Chro\t nCont\t nRep\t l_\t s_\t lum_\t ls45\t ls135\t luml45\t luml135\t lums45\t luml135\n')
end
% fo = fopen(infoFile, 'at')
fprintf(fo, '%s\t%i/%i/%i %i:%i:%i\t %1.2f\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\n',...
subName, theDate(2), theDate(3), theDate(1), theDate(4), theDate(5), round(theDate(6)),...
meanLum, nBckg_Chro, nCont, nRep,axis_chck(1),axis_chck(2),...
axis_chck(3),axis_chck(4) ,axis_chck(5),axis_chck(6),...
axis_chck(7),axis_chck(8),axis_chck(9));
% % % % fprintf(fo, '%s\t%i/%i/%i %i:%i:%i\t %1.2f\t%1.3f\t%1.3f\t%i\n',...
% % % % subName, theDate(2), theDate(3), theDate(1), theDate(4), theDate(5), round(theDate(6)),...
% % % % maxLum, white(1),white(2), nRep)%,curr_cond(1),curr_cond(2),...
% % % % % % curr_cond(3),curr_cond(4) ,curr_cond(5),curr_cond(6),...
% % % % % % curr_cond(7),curr_cond(8),curr_cond(9));
fclose(fo)
%% set up psych toolbox
%set up 10 bit color
PsychImaging('PrepareConfiguration');
%PsychImaging('AddTask', 'General', 'EnableNative10BitFrameBuffer',1); %the 0 is turn off dithering?
expScreen = 1;
%create white LUT
% cd(a);
% % % wLMS(1,1) = white(1,1)*maxLum;
% % % wLMS(1,2) = (1-white(1,1))*maxLum;
% % % wLMS(1,3) = white(1,2)*maxLum;
% % % wXYZ(1,:) = LMS_to_XYZ(wLMS(1,:));
% % % wRGB(1,:) = XYZ_to_RGB(wXYZ(1,:), maxPhosXYZ);
% % % wRGB(1,1) = pix(dsearchn(redProp(:), wRGB(1,1)))*hfpRG;
% % % wRGB(1,2) = pix(dsearchn(grnProp(:), wRGB(1,2)));
% % % wRGB(1,3) = pix(dsearchn(blueProp(:), wRGB(1,3)))*hfpBG;
[window, windowRect] = PsychImaging('OpenWindow', expScreen, [0 0 0], [], [], []); % Set a black screen before starting
%Screen('OpenWindow',0, [0 0 0]); %makes main screen dark
%PsychImaging('OpenWindow', expScreen, wRGB);
[xcent,ycent] = RectCenter(windowRect);
center = [xcent ycent];
%% TIMING
%find frames per second
ifi = Screen('GetFlipInterval', window);% Measure the vertical refresh rate of the monitor
topPriorityLevel = MaxPriority(window);% Retreive the maximum priority number
numSecs = 16; %in seconds, total presentation time
framesPerSec = round(1/ifi);
nFrames = numSecs * framesPerSec;
waitframes = 1; %number of frames to wait between refresh
% color changed .03 of full cycle per second - finished 1/2 cycle in 16 seconds, 1/32
%in Zaidi, clock face appears at 10.15 seconds, will approximate this
%number
zaidiClock = 10.15; %is when Zaidi started in his example.
clFrmStart = floor(1/ifi*zaidiClock);
clTotTime = 2.9*2; %how long is clock in the screen
handInt = 12*2; %how many places to stop around the clock
clFrames = floor(clTotTime/handInt/ifi); %this will move the hand 15 degrees at a time, and decides how many frames to sit at each angle
%% Stimulus Size Parameters
circleDeg = 3.6;
clockPt = 0.1;
% code assumes 1 pixel = 1 arc min
pixPerDeg = 35; %at a distance of 57 cm
circlePix = circleDeg*pixPerDeg;
clockPix = clockPt*pixPerDeg;
tstcircle = [xcent - circlePix/2 ycent - circlePix/2 xcent + circlePix/2 ycent + circlePix/2];
%create circular grid for clock face and the numbers
rad = circleDeg/2*pixPerDeg; %circlePix/2-pixPerDeg/2;
radNum = (circleDeg/2) * pixPerDeg;
clockDegs = [1:15:360];
for iC = 1:length(clockDegs)
[xcFace(iC), ycFace(iC)] = pol2cart(clockDegs(iC)*pi/180, rad);
[xcNumber(iC), ycNumber(iC)] = pol2cart(clockDegs(iC)*pi/180, radNum);
end
%create matrix of dot locations
clockPosMat = [reshape(xcFace,1, length(clockDegs)); reshape(ycFace,1, length(clockDegs))];
clockNumMat = [reshape(xcNumber,1, length(clockDegs)); reshape(ycNumber,1, length(clockDegs))];
Screen('TextSize', window, 14);
textOne = [6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 2 3 4 5];
yPositionIsBaseline=1;
%create array of second hand positions to index
count = 1;
secHandCord(1:handInt) = (1:15:360)*(pi/180);
for iMove = 1:length(secHandCord)
secHandMove(count:count+clFrames-1) = secHandCord(iMove);
count = count+clFrames;
end
secHandMove(length(secHandMove)+1:length(secHandMove)*2) = secHandMove(1:length(secHandMove));
WaitSecs(1);
%%/////////////////////////////////////////////////////////////////////////
%%///////////////////////// EXPERIMENT TRIALS /////////////////////////////
%%/////////////////////////////////////////////////////////////////////////
clear iCond
curr_axis = find(axis_chck)
%run experiment
TrialCount = 1;
for iChro = 1:size(Bckg_Chro,1)
wLMS(1,1) = Bckg_Chro(iChro,1)*meanLum;
wLMS(1,2) = (1-Bckg_Chro(iChro,1))*meanLum;
wLMS(1,3) = Bckg_Chro(iChro,2)*meanLum;
wXYZ(1,:) = LMS_to_XYZ(wLMS(1,:));
wRGB(1,:) = XYZ_to_RGB(wXYZ(1,:), maxPhosXYZ);
wRGB(1,1) = pix(dsearchn(redProp(:), wRGB(1,1)))*hfpRG;
wRGB(1,2) = pix(dsearchn(grnProp(:), wRGB(1,2)));
wRGB(1,3) = pix(dsearchn(blueProp(:), wRGB(1,3)))*hfpBG;
commandwindow;
Speak('Press Any Key when you are ready');
KbStrokeWait;
Screen('FillRect', window, wRGB);
Screen('Flip',window)
WaitSecs(AdaptTime)
for iRep = 1:nRep
cont = randperm(nCont); %randomize contrast conditions
for iCont = 1:nCont
FlushEvents('mouseDown','keyDown');
%create colors with depending on contrast
l = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum]; %+l, -l
s = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum];%+s, -s
lum = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2) meanLum-lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2) meanLum+lumMod(iChro,cont(iCont))]; % -lum , +lum
l_s_45 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum];
l_s_135 = [Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum
Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum];
lum_l_45 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum+lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum-lumMod(iChro,cont(iCont))];
lum_l_135 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum-lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum+lumMod(iChro,cont(iCont))];
lum_s_45 = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum+lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum-lumMod(iChro,cont(iCont))];
lum_s_135 = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum-lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum+lumMod(iChro,cont(iCont))];
rnd_idx = randperm(length(curr_axis));
curr_axis = curr_axis(rnd_idx)
% cond = randperm(9);
for iCond = 1:length(curr_axis)
%create table of color changes
switch curr_axis(iCond)
case 1
colLut = l;
case 2
colLut = s;
case 3 %%%% ATENCION que ahora LUM es la condicion 3
colLut = lum;
case 4
colLut = l_s_45;
case 5
colLut = l_s_135;
case 6
colLut = lum_l_45;
case 7
colLut = lum_l_135;
case 8
colLut = lum_s_45;
case 9
colLut = lum_s_135;
end
%LMS values of each color, ls to LMS
for iLMS = 1:2
cLMS(iLMS,1) = colLut(iLMS,1)*colLut(iLMS, 3);
cLMS(iLMS,2) = (1-colLut(iLMS,1))*colLut(iLMS, 3);
cLMS(iLMS,3) = colLut(iLMS,2)*colLut(iLMS, 3);
end
%XYZ values for each
for iXYZ = 1:length(cLMS(:,1))
cXYZ(iXYZ,:) = LMS_to_XYZ(cLMS(iXYZ,:));
end
%use lut to find corrected monitor RGB values for each rgb color
for iRGB = 1:length(cXYZ(:,1))
cRGB(iRGB,:) = XYZ_to_RGB(cXYZ(iRGB,:), maxPhosXYZ);
cRGB(iRGB,1) = pix(dsearchn(redProp(:), cRGB(iRGB,1)))*hfpRG;
cRGB(iRGB,2) = pix(dsearchn(grnProp(:), cRGB(iRGB,2)));
cRGB(iRGB,3) = pix(dsearchn(blueProp(:), cRGB(iRGB,3)))*hfpBG;
end
rampLeft = zeros(nFrames,3);
rampRight = zeros(nFrames,3);
for iRamp = 1:3 %for 3 phosophors
rampLeft(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(1,iRamp), nFrames);
rampRight(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(2,iRamp), nFrames);
end
%create random start point for clock hand
randStrt = randi(handInt-1); %won't pick midnight as start point due to second hand array not being long enough
%clock set to go around 1 full circle
for ihand = 1:handInt*clFrames+clFrames
th(ihand) = (secHandMove(randStrt*clFrames-clFrames+ihand));
[handx(ihand), handy(ihand)] = pol2cart(th(ihand),rad);
end
handx = handx + xcent;
handy = handy + ycent;
%/////////////
switch OneHemi_chck
case 0 %if FullCircle
Dir = [1 -1];
case 1
Dir = [2 -2]; %just one hemifield modulated
end
Dir_rnd = randperm(2);
for iDir = 1:2
Card_Dir = Dir(Dir_rnd(iDir));
switch Card_Dir
case {1,2}
ramp = rampLeft; % Increment
HF_posit = 0; % to place the hemifield in the LEFT position
case {-1,-2}
ramp = rampRight; % Decrement
HF_posit = 180; % to place the hemifield in the RIGHT position
end
%----------------------------------------
% Random Clock Start
%----------------------------------------
%create random start point for clock hand
randStrt = randi(handInt-1); %won't pick midnight as start point due to second hand array not being long enough
%clock set to go around 1 full circle
for ihand = 1:handInt*clFrames+clFrames
th(ihand) = (secHandMove(randStrt*clFrames-clFrames+ihand));
[handx(ihand), handy(ihand)] = pol2cart(th(ihand),rad);
end
handx = handx + xcent;
handy = handy + ycent;
WaitSecs(5); %a short adaptation before the next trial
keypress = 0;
count = 0; %for clock hand
TrialCountStr = num2str(TrialCount);
Priority(topPriorityLevel);
FlushEvents('mouseDown','keyDown');
%ListenChar(2)
secs0 = Screen('Flip', window);
for iFrames = 1:nFrames
switch OneHemi_chck%if FullCircle
case 0
%Full Circle
Screen('FillOval', window, ramp(iFrames,:), tstcircle );
case 1
% One Hemifield Modulated
Screen('FillArc', window, ramp(iFrames,:), tstcircle, HF_posit, 180);
end
% Screen('FillArc', window, rampLeft(iFrames,:), tstcircle, 0, 180);
% Screen('FillArc', window, rampRight(iFrames,:), tstcircle, 180, 180);
Screen('DrawDots', window, clockPosMat,clockPix, blackLut, center, 2);
Screen('DrawDots', window, [0 0],clockPix, 0, center, 2); % black dot for fixation
Screen('DrawText', window, TrialCountStr, 20, 20, redLut, wRGB);
for itxt = 1:24
textNum = sprintf('%i', textOne(itxt));
Screen('DrawText', window, textNum, 1.18*clockNumMat(1,itxt)+center(1,1)-7, 1.18*clockNumMat(2,itxt)+center(1,2)-7, blackLut, wRGB);
end
if iFrames == clFrmStart
beep;
end
if iFrames > clFrmStart-1 && iFrames < clFrmStart + handInt*clFrames+5
count = count+1;
Screen('DrawLine', window, redLut, xcent, ycent, handx(count), handy(count), 2.5);
end
vbl = Screen('Flip', window, secs0 + (waitframes - 0.5) * ifi);
Screen('DrawingFinished', window); % tell psychtoolbox drawing is finished, should help timing
end
Priority(0);
% % % % while ~keypress
% % % % if CharAvail
% % % % userRes = input(' ');
% % % % keypress = 1;
% % % % end
% % % % end
% % % % FlushEvents('mouseDown','keyDown');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% RESPONSES %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if Simu_chck
userRes = 'simu';
else
keyIsDown=0;
kbName=[];
Digit = [];
Nums = {'0','1','2','3','4','5','6','7','8','9'};
Screen('TextSize', window, 30);
commandwindow;
while keyIsDown==0 | (strcmp('ENTER',kbName)==0)% & strcmp('2',kbName)==0)
keyIsDown=0;
[keyIsDown, secs, keyCode] = KbCheck;
if keyIsDown==1 %
kbName = KbName(keyCode);
end
if Digit & any(strcmp(Nums(:),kbName));
idx=find(strcmp(Nums(:),kbName));
NumPressed = Nums{idx};
kbName = strcat(firstDigit,NumPressed);
userRes = kbName;
% DrawFormattedText(window, kbName, 'center', 'center', color);
DrawFormattedText(window, kbName, 400, 512, redLut);
Screen('Flip', window);
kbName = [];
Digit = 0;
WaitSecs(.4);
elseif any(strcmp(Nums(:),kbName))
idx=find(strcmp(Nums(:),kbName));
NumPressed = Nums{idx};
userRes = kbName;
%-si es numero -- llevarlo a la pantalla
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
Digit = 1 ;% flag to mean that
firstDigit = kbName;
WaitSecs(.4);
kbName = [];
end
if strcmp('DELETE',kbName)==1 %-si es el backspace --limpiar numero
kbName = []% ;
userRes = kbName
firstDigit = [];
Digit = 0;
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
%else % -si no es numero -- ignorar
WaitSecs(.4);
end
end %end while
end
% userRes = num2str(2);
AfterResp = 'OK'
Screen('TextSize', window, 14);
FlushEvents('mouseDown','keyDown');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SAVE %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
% aa = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\A Outputs')
cd
WaitSecs(.2)
time = clock;
fprintf(fp, '%s\t%i/%i/%i %i:%i:%i\t%1.3f\t%1.3f\t%1.3f\t%1.3f\t%i\t%i\t%i\t%i\t%s\tExperiment\n',...
subName, time(2), time(3), time(1), time(4), time(5), round(time(6)), hfpRG, hfpBG, Bckg_Chro(iChro,1), Bckg_Chro(iChro,2), cont(iCont), curr_axis(iCond), Card_Dir, randStrt+5, userRes);
% a = cd('/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/4 ColBackg AI'); %
% a = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\4 AfterImage'); %
cd
WaitSecs(.2)
%ListenChar(0)
Screen('FillRect', window, wRGB, windowRect);
Screen('Flip', window);
clear secHandCord colLut
TrialCount = TrialCount+1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% WANT TO STOP? %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% pause(3)
yesno=evalin('base','Stop_Press')
if yesno==1
return
end
end %iDir
end %ICond
end %iCont
end %iRep
end %iChro
fclose(fp);
sca
%create a matrix of seconds compared to pi values for each frame - just
%used in data analysis
% % % % piVSsecs(:,1) = [0:1/(nFrames-1):1];
% % % % piVSsecs(:,2) = [0:numSecs/(nFrames-1):numSecs];
catch
warndlg('The program failed to run. Try again.')
return
end
end

600
002 After Image GUI Project/AfIm_pupil_Exp.m

@ -0,0 +1,600 @@
function AfIm_pupil_Exp(subName,meanLum,Bckg_Chro,axis_chck,AdaptTime,nRep,OneHemi_chck,Simu_chck)
Clock = 0;
%%%%%%%%%%%%%%%%
% ARDUINO and CAMERA settings
Cam_freq = 240 ; % square waves freq
Cam_RECduration = 30; %in seconds. (30secs is the maximal time allowed by Matlab to play tone in arduino board)
ard = arduino; % open arduino
%%%%%%%%%%%%%%%
try
assignin('base','Stop_Press',0)% this works for the STOP experiment button
% Check that Psychtoolbox is properly installed, switch to unified KbName's
% across operating systems, and switch color range to normalized 0 - 1 range:
PsychDefaultSetup(2);
saveFile = sprintf('%s_Pupil_AfIm', subName)
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
fp = fopen(saveFile, 'at');
%% Color information, load hfp data and color calibration
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
hfpFile = sprintf('%sHFP', subName);
load(hfpFile, '-mat')
hfpRG = rg_avg;
hfpBG = bg_avg;
% cd(a); % return to program folder.
Calib_Dire = cd('/Users/clemente/Desktop/AfterImage Programs/002 After Image GUI Project');
load colorCalFile1.mat
fprintf('\nLast calibration was %s\n', describe.date)
pix = pix/1001;
cd(aa) ;% output folder
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
% aa = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\A Outputs')
% maxLum = 20; %cd/m^2
contFile = sprintf('%s_ContMatch', subName);
cd
load(contFile, '-mat')
lCont = Final_lCont_avg;
lumMod = Final_lumMod_avg;
sCont = Final_sCont_ref;
nCont = size(sCont,2);
nBckg_Chro = size(Bckg_Chro,1);
% white = [.665 1];
blackLut = [0 0 0];
redLut = [.8 0 0];
% Bckg_Chro = Final_lCont_avg(:,1:2)
%% Save Session Information
theDate = fix(clock);
% a = '/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/4 ColBackg AI' ;% folder where the program is.
infoFile = sprintf('%s_SessionsInfo', subName)
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs'); ;% folder where the program is.
checkfile = exist(infoFile, 'file')
fo = fopen(infoFile, 'at')
if checkfile == 0 % if file doesn't exist, then print the following header:
fprintf(fo,'Subject\t Date\t Time\t Lum\t nBckg_Chro\t nCont\t nRep\t l_\t s_\t lum_\t ls45\t ls135\t luml45\t luml135\t lums45\t luml135\n')
end
% fo = fopen(infoFile, 'at')
fprintf(fo, '%s\t%i/%i/%i %i:%i:%i\t %1.2f\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\t%i\tPupil\n',...
subName, theDate(2), theDate(3), theDate(1), theDate(4), theDate(5), round(theDate(6)),...
meanLum, nBckg_Chro, nCont, nRep,axis_chck(1),axis_chck(2),...
axis_chck(3),axis_chck(4) ,axis_chck(5),axis_chck(6),...
axis_chck(7),axis_chck(8),axis_chck(9));
% % % % fprintf(fo, '%s\t%i/%i/%i %i:%i:%i\t %1.2f\t%1.3f\t%1.3f\t%i\n',...
% % % % subName, theDate(2), theDate(3), theDate(1), theDate(4), theDate(5), round(theDate(6)),...
% % % % maxLum, white(1),white(2), nRep)%,curr_cond(1),curr_cond(2),...
% % % % % % curr_cond(3),curr_cond(4) ,curr_cond(5),curr_cond(6),...
% % % % % % curr_cond(7),curr_cond(8),curr_cond(9));
fclose(fo)
%% set up psych toolbox
%set up 10 bit color
PsychImaging('PrepareConfiguration');
%PsychImaging('AddTask', 'General', 'EnableNative10BitFrameBuffer',1); %the 0 is turn off dithering?
expScreen = 1;
%create white LUT
% cd(a);
% % % wLMS(1,1) = white(1,1)*maxLum;
% % % wLMS(1,2) = (1-white(1,1))*maxLum;
% % % wLMS(1,3) = white(1,2)*maxLum;
% % % wXYZ(1,:) = LMS_to_XYZ(wLMS(1,:));
% % % wRGB(1,:) = XYZ_to_RGB(wXYZ(1,:), maxPhosXYZ);
% % % wRGB(1,1) = pix(dsearchn(redProp(:), wRGB(1,1)))*hfpRG;
% % % wRGB(1,2) = pix(dsearchn(grnProp(:), wRGB(1,2)));
% % % wRGB(1,3) = pix(dsearchn(blueProp(:), wRGB(1,3)))*hfpBG;
[window, windowRect] = PsychImaging('OpenWindow', expScreen, [0 0 0], [], [], []); % Set a black screen before starting
%Screen('OpenWindow',0, [0 0 0]); %makes main screen dark
%PsychImaging('OpenWindow', expScreen, wRGB);
[xcent,ycent] = RectCenter(windowRect);
center = [xcent ycent];
%% TIMING
%find frames per second
ifi = Screen('GetFlipInterval', window);% Measure the vertical refresh rate of the monitor
topPriorityLevel = MaxPriority(window);% Retreive the maximum priority number
numSecs = 8; %in seconds, total presentation time
framesPerSec = round(1/ifi);
nFrames = numSecs * framesPerSec;
waitframes = 1; %number of frames to wait between refresh
% color changed .03 of full cycle per second - finished 1/2 cycle in 16 seconds, 1/32
%in Zaidi, clock face appears at 10.15 seconds, will approximate this
%number
zaidiClock = 2%10.15; %is when Zaidi started in his example.
clFrmStart = floor(1/ifi*zaidiClock);
clTotTime = 6%2.9*2; %how long is clock in the screen
handInt = 12*2; %how many places to stop around the clock
clFrames = floor(clTotTime/handInt/ifi); %this will move the hand 15 degrees at a time, and decides how many frames to sit at each angle
if Clock
ISI = 8;
else
ISI = 20;
end
%% Stimulus Size Parameters
circleDeg = 7.2;
clockPt = 0.1;
% code assumes 1 pixel = 1 arc min
pixPerDeg = 35; %at a distance of 57 cm
circlePix = circleDeg*pixPerDeg;
clockPix = clockPt*pixPerDeg;
tstcircle = [xcent - circlePix/2 ycent - circlePix/2 xcent + circlePix/2 ycent + circlePix/2];
%create circular grid for clock face and the numbers
% % % circleDegGrid = 2 ;
% % % rad = circleDegGrid/2*pixPerDeg; %circlePix/2-pixPerDeg/2;
rad = circleDeg/2*pixPerDeg; %circlePix/2-pixPerDeg/2;
radNum = (circleDeg/2) * pixPerDeg;
clockDegs = [1:15:360];
for iC = 1:length(clockDegs)
[xcFace(iC), ycFace(iC)] = pol2cart(clockDegs(iC)*pi/180, rad);
[xcNumber(iC), ycNumber(iC)] = pol2cart(clockDegs(iC)*pi/180, 1*radNum);
end
%create matrix of dot locations
clockPosMat = [reshape(xcFace,1, length(clockDegs)); reshape(ycFace,1, length(clockDegs))];
clockNumMat = [reshape(xcNumber,1, length(clockDegs)); reshape(ycNumber,1, length(clockDegs))];
Screen('TextSize', window, 14);
textOne = [6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 2 3 4 5];
yPositionIsBaseline=1;
%create array of second hand positions to index
count = 1;
secHandCord(1:handInt) = (1:15:360)*(pi/180);
for iMove = 1:length(secHandCord)
secHandMove(count:count+clFrames-1) = secHandCord(iMove);
count = count+clFrames;
end
secHandMove(length(secHandMove)+1:length(secHandMove)*2) = secHandMove(1:length(secHandMove));
WaitSecs(1);
%%/////////////////////////////////////////////////////////////////////////
%%///////////////////////// EXPERIMENT TRIALS /////////////////////////////
%%/////////////////////////////////////////////////////////////////////////
clear iCond
curr_axis = find(axis_chck)
%run experiment
TrialCount = 1;
Card_Dir = 0;
for iChro = 1:size(Bckg_Chro,1)
wLMS(1,1) = Bckg_Chro(iChro,1)*meanLum;
wLMS(1,2) = (1-Bckg_Chro(iChro,1))*meanLum;
wLMS(1,3) = Bckg_Chro(iChro,2)*meanLum;
wXYZ(1,:) = LMS_to_XYZ(wLMS(1,:));
wRGB(1,:) = XYZ_to_RGB(wXYZ(1,:), maxPhosXYZ);
wRGB(1,1) = pix(dsearchn(redProp(:), wRGB(1,1)))*hfpRG;
wRGB(1,2) = pix(dsearchn(grnProp(:), wRGB(1,2)));
wRGB(1,3) = pix(dsearchn(blueProp(:), wRGB(1,3)))*hfpBG;
commandwindow;
Speak(' Press any key when you are ready');
KbStrokeWait;
% Adaptation screen
Screen('FillRect', window, wRGB);
Screen('DrawDots', window, [0 0],clockPix, 0, center, 2); % black dot for fixation
Screen('Flip',window)
WaitSecs(AdaptTime)
cont = randperm(nCont); %randomize contrast conditions
for iCont = 1:nCont
for iRep = 1:nRep
FlushEvents('mouseDown','keyDown');
%create colors with depending on contrast
l = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum]; %+l, -l
s = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum];%+s, -s
lum = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2) meanLum-lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2) meanLum+lumMod(iChro,cont(iCont))]; % -lum , +lum
l_s_45 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum];
l_s_135 = [Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum
Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum];
lum_l_45 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum+lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum-lumMod(iChro,cont(iCont))];
lum_l_135 = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum-lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont(iChro,cont(iCont))) Bckg_Chro(iChro,2) meanLum+lumMod(iChro,cont(iCont))];
lum_s_45 = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum+lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum-lumMod(iChro,cont(iCont))];
lum_s_135 = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum-lumMod(iChro,cont(iCont))
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(iChro,cont(iCont))) meanLum+lumMod(iChro,cont(iCont))];
rnd_idx = randperm(length(curr_axis));
curr_axis = curr_axis(rnd_idx)
% cond = randperm(9);
for iCond = 1:length(curr_axis)
%create table of color changes
switch curr_axis(iCond)
case 1
colLut = l;
case 2
colLut = s;
case 3 %%%% ATENCION que ahora LUM es la condicion 3
colLut = lum;
case 4
colLut = l_s_45;
case 5
colLut = l_s_135;
case 6
colLut = lum_l_45;
case 7
colLut = lum_l_135;
case 8
colLut = lum_s_45;
case 9
colLut = lum_s_135;
end
%LMS values of each color, ls to LMS
for iLMS = 1:2
cLMS(iLMS,1) = colLut(iLMS,1)*colLut(iLMS, 3);
cLMS(iLMS,2) = (1-colLut(iLMS,1))*colLut(iLMS, 3);
cLMS(iLMS,3) = colLut(iLMS,2)*colLut(iLMS, 3);
end
%XYZ values for each
for iXYZ = 1:length(cLMS(:,1))
cXYZ(iXYZ,:) = LMS_to_XYZ(cLMS(iXYZ,:));
end
%use lut to find corrected monitor RGB values for each rgb color
for iRGB = 1:length(cXYZ(:,1))
cRGB(iRGB,:) = XYZ_to_RGB(cXYZ(iRGB,:), maxPhosXYZ);
cRGB(iRGB,1) = pix(dsearchn(redProp(:), cRGB(iRGB,1)))*hfpRG;
cRGB(iRGB,2) = pix(dsearchn(grnProp(:), cRGB(iRGB,2)));
cRGB(iRGB,3) = pix(dsearchn(blueProp(:), cRGB(iRGB,3)))*hfpBG;
end
rampLeft = zeros(nFrames,3);
rampRight = zeros(nFrames,3);
for iRamp = 1:3 %for 3 phosophors
rampLeft(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(1,iRamp), nFrames);
rampRight(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(2,iRamp), nFrames);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% loadCombined =1;
% if loadCombined
% rampLeft = importdata('rampLeft_Combined.mat');
% rampRight = importdata('rampRight_Combined.mat');
% end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%create random start point for clock hand
randStrt = randi(handInt-1); %won't pick midnight as start point due to second hand array not being long enough
%clock set to go around 1 full circle
for ihand = 1:handInt*clFrames+clFrames
th(ihand) = (secHandMove(randStrt*clFrames-clFrames+ihand));
[handx(ihand), handy(ihand)] = pol2cart(th(ihand),1*rad);
end
handx = handx + xcent;
handy = handy + ycent;
%/////////////
switch OneHemi_chck
case 0 %if FullCircle
Dir = [-1];
case 1
Dir = [2 -2]; %just one hemifield modulated
end
Dir_rnd = randperm(1);
for iDir = 1:1
Card_Dir = Dir(Dir_rnd(iDir));
switch Card_Dir
case {1,2}
ramp = rampLeft; % Increment
HF_posit = 0; % to place the hemifield in the LEFT position
case {-1,-2}
ramp = rampRight; % Decrement
HF_posit = 180; % to place the hemifield in the RIGHT position
end
%---------------------------
if ~Clock
flatSound; % so the subject prepare for the stimulus
WaitSecs(4); % a few seconds before start recording
%%%%%%%%%%%%%%%%%%%%%%%%%
% START CAMERA RECORDING
playTone(ard,'D3',240,Cam_RECduration); %
%%%%%%%%%%%%%%%%%%%%
WaitSecs(4); %
end
keypress = 0;
count = 0; %for clock hand
TrialCountStr = num2str(TrialCount);
Priority(topPriorityLevel);
FlushEvents('mouseDown','keyDown');
%ListenChar(2)
secs0 = Screen('Flip', window);
for iFrames = 1:nFrames
% switch OneHemi_chck%if FullCircle
% case 0
%Full Circle
Screen('FillOval', window, ramp(iFrames,:), tstcircle );
% case 1
% % One Hemifield Modulated
% Screen('FillArc', window, ramp(iFrames,:), tstcircle, HF_posit, 180);
% end
% % % Screen('FillArc', window, rampLeft(iFrames,:), tstcircle, 0, 180);
% % % Screen('FillArc', window, rampRight(iFrames,:), tstcircle, 180, 180);
Screen('DrawDots', window, [0 0],clockPix, 0, center, 2); % black dot for fixation
if Clock %---------------------
Screen('DrawDots', window, clockPosMat,clockPix, blackLut, center, 2);
Screen('DrawText', window, TrialCountStr, 20, 20, redLut, wRGB);
for itxt = 1:24
textNum = sprintf('%i', textOne(itxt));
Screen('DrawText', window, textNum, 1.18*clockNumMat(1,itxt)+center(1,1)-7, 1.18*clockNumMat(2,itxt)+center(1,2)-7, blackLut, wRGB);
end
if iFrames == clFrmStart
beep;
end
if iFrames > clFrmStart-1 && iFrames < clFrmStart + handInt*clFrames+5
count = count+1;
Screen('DrawLine', window, redLut, xcent, ycent, handx(count), handy(count), 2.5);
end
end % Clock ---------------------
% % %-----------------
% % % PrintScreen of the monitor (for the paper)
% % % GetImage call. Alter the rect argument to change the location of the screen shot
% % imageArray = Screen('GetImage', window, [0 0 300 300]);
% % % imwrite is a Matlab function, not a PTB-3 function
% % imwrite(imageArray, 'test.jpg')
% % %------------------
vbl = Screen('Flip', window, secs0 + (waitframes - 0.5) * ifi);
Screen('DrawingFinished', window); % tell psychtoolbox drawing is finished, should help timing
end
Priority(0);
if ~Clock
WaitSecs(18); % to tell the subject to blink normally
flatSound;
end
% Speak('Report Time')
% WaitSecs(5)% This is sumed to the ISI except for the last trial
% % % % while ~keypress
% % % % if CharAvail
% % % % userRes = input(' ');
% % % % keypress = 1;
% % % % end
% % % % end
% % % % FlushEvents('mouseDown','keyDown');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% RESPONSES %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if Clock
% if Simu_chck
% userRes = 'simu';
%
% else
keyIsDown=0;
kbName=[];
Digit = [];
Nums = {'0','1','2','3','4','5','6','7','8','9'};
Screen('TextSize', window, 30);
commandwindow;
while keyIsDown==0 | (strcmp('ENTER',kbName)==0)% & strcmp('2',kbName)==0)
keyIsDown=0;
[keyIsDown, secs, keyCode] = KbCheck;
if keyIsDown==1 %
kbName = KbName(keyCode);
end
if Digit & any(strcmp(Nums(:),kbName));
idx=find(strcmp(Nums(:),kbName));
NumPressed = Nums{idx};
kbName = strcat(firstDigit,NumPressed);
userRes = kbName;
% DrawFormattedText(window, kbName, 'center', 'center', color);
DrawFormattedText(window, kbName, 400, 512, redLut);
Screen('Flip', window);
kbName = [];
Digit = 0;
WaitSecs(.4);
elseif any(strcmp(Nums(:),kbName))
idx=find(strcmp(Nums(:),kbName));
NumPressed = Nums{idx};
userRes = kbName;
%-si es numero -- llevarlo a la pantalla
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
Digit = 1 ;% flag to mean that
firstDigit = kbName;
WaitSecs(.4);
kbName = [];
end
if strcmp('DELETE',kbName)==1 %-si es el backspace --limpiar numero
kbName = []% ;
userRes = kbName
firstDigit = [];
Digit = 0;
DrawFormattedText(window, kbName, 400, 512, redLut);
% Flip to the screen
Screen('Flip', window);
%else % -si no es numero -- ignorar
WaitSecs(.4);
end
end %end while
% end % end simu_chck
else
randStrt = 94;% it will be saved as 99
userRes = '99';
end % Clock
% userRes = num2str(2);
%
% AfterResp = 'OK'
Screen('TextSize', window, 14);
FlushEvents('mouseDown','keyDown');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SAVE %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
% aa = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\A Outputs')
cd
WaitSecs(.2)
time = clock;
% % fprintf(fp, '%s\t%i/%i/%i %i:%i:%i\t%1.3f\t%1.3f\t%1.3f\t%1.3f\t%i\t%i\t%i\t%i\tExperiment\n',...
% % subName, time(2), time(3), time(1), time(4), time(5), round(time(6)), hfpRG, hfpBG, Bckg_Chro(iChro,1), Bckg_Chro(iChro,2), cont(iCont), curr_axis(iCond), Card_Dir, userRes);
fprintf(fp, '%s\t%i/%i/%i %i:%i:%i\t%1.3f\t%1.3f\t%1.3f\t%1.3f\t%i\t%i\t%i\t%i\t%s\tPupilExp\n',...
subName, time(2), time(3), time(1), time(4), time(5), round(time(6)), hfpRG, hfpBG, Bckg_Chro(iChro,1), Bckg_Chro(iChro,2), cont(iCont), curr_axis(iCond), Card_Dir, randStrt+5, userRes);
% a = cd('/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/4 ColBackg AI'); %
% a = cd('D:\Dropbox\Luminotecnia\2017\Chicago Lab files\2 Experiments\Color AfterImage_Exp_Room_150\2nd\1 Programs\4 AfterImage'); %
cd
WaitSecs(.2)
%ListenChar(0)
Screen('FillRect', window, wRGB, windowRect);
Screen('DrawDots', window, [0 0],clockPix, 0, center, 2); % black dot for fixation
Screen('Flip', window);
clear secHandCord colLut
TrialCount = TrialCount+1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% WANT TO STOP? %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% pause(3)
yesno=evalin('base','Stop_Press')
if yesno==1
return
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
WaitSecs(ISI); %
end % iDir
end %ICond
end %iCont
end %iRep
end %iChro
%%%%%%%%%%%%%%%%%%
% STOP CAMERA
Speak('Stop camera software');
WaitSecs(10);
writeDigitalPin(ard,'D3',1);
writeDigitalPin(ard,'D3',0);
%%%%%%%%%%%%%%%%%
fclose(fp);
sca
%create a matrix of seconds compared to pi values for each frame - just
%used in data analysis
% % % % piVSsecs(:,1) = [0:1/(nFrames-1):1];
% % % % piVSsecs(:,2) = [0:numSecs/(nFrames-1):numSecs];
catch
warndlg('The program failed to run. Try again.')
return
end
end

BIN
002 After Image GUI Project/AppTEST copy.mlapp

Binary file not shown.

91
002 After Image GUI Project/AppTESTpackaged.prj

@ -0,0 +1,91 @@
<deployment-project plugin="plugin.apptool" plugin-version="1.0">
<configuration build-checksum="2281312939" file="/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/002 After Image GUI Project/AppTESTpackaged.prj" location="/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/002 After Image GUI Project" name="AppTESTpackaged" target="target.mlapps" target-name="Package App">
<param.appname>AppTESTpackaged</param.appname>
<param.authnamewatermark>CP</param.authnamewatermark>
<param.email />
<param.company>UIC</param.company>
<param.icon>${PROJECT_ROOT}/AppTESTpackaged_resources/icon_24.png</param.icon>
<param.icons>
<file>${PROJECT_ROOT}/AppTESTpackaged_resources/icon_48.png</file>
<file>${PROJECT_ROOT}/AppTESTpackaged_resources/icon_24.png</file>
<file>${PROJECT_ROOT}/AppTESTpackaged_resources/icon_16.png</file>
</param.icons>
<param.summary />
<param.description />
<param.screenshot />
<param.version>1.0</param.version>
<param.products.name>
<item>MATLAB</item>
</param.products.name>
<param.products.id>
<item>1</item>
</param.products.id>
<param.products.version>
<item>9.0</item>
</param.products.version>
<param.platforms />
<param.output>/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/002 After Image GUI Project</param.output>
<param.guid>602a72bb-7004-4a02-a8fc-d08478156bbd</param.guid>
<unset>
<param.email />
<param.summary />
<param.description />
<param.screenshot />
<param.version />
<param.platforms />
<param.output />
</unset>
<fileset.main />
<fileset.depfun />
<fileset.resources />
<fileset.package />
<build-deliverables>
<file location="/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs" name="002 After Image GUI Project" optional="false">/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/002 After Image GUI Project</file>
</build-deliverables>
<workflow />
<matlab>
<root>/Applications/MATLAB_R2016a.app</root>
<toolboxes>
<toolbox name="fixedpoint" />
<toolbox name="matlabcoder" />
<toolbox name="matlabhdlcoder" />
<toolbox name="embeddedcoder" />
</toolboxes>
<toolbox>
<fixedpoint>
<enabled>true</enabled>
</fixedpoint>
</toolbox>
<toolbox>
<matlabcoder>
<enabled>true</enabled>
</matlabcoder>
</toolbox>
<toolbox>
<matlabhdlcoder>
<enabled>true</enabled>
</matlabhdlcoder>
</toolbox>
<toolbox>
<embeddedcoder>
<enabled>true</enabled>
</embeddedcoder>
</toolbox>
</matlab>
<platform>
<unix>true</unix>
<mac>true</mac>
<windows>false</windows>
<win2k>false</win2k>
<winxp>false</winxp>
<vista>false</vista>
<linux>false</linux>
<solaris>false</solaris>
<osver>10.12.6</osver>
<os32>false</os32>
<os64>true</os64>
<arch>maci64</arch>
<matlab>true</matlab>
</platform>
</configuration>
</deployment-project>

489
002 After Image GUI Project/ContMatch_session.m

@ -0,0 +1,489 @@
function ContMatch_session(subName,meanLum,Bckg_Chro,AdaptTime,curr_cond)
try
assignin('base','Stop_Press',0)% this works for the STOP experiment button
commandwindow; % open this, and the cursor will appear there
% Check that Psychtoolbox is properly installed, switch to unified KbName's
% across operating systems, and switch color range to normalized 0 - 1 range:
PsychDefaultSetup(2);
%% Start Experiment
a = cd;
theDate = fix(clock);
saveFile = sprintf('%s_ContMatch.mat', subName);
%% Color information, load hfp data and color calibration
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
hfpFile = sprintf('%sHFP', subName);
load(hfpFile, '-mat')
hfpRG = rg_avg
hfpBG = bg_avg
% hfpRG = .89;
% hfpBG = 1 ;
%% Load previous matched contrast
name = sprintf('%s_ContMatch.mat', subName);
if exist(name, 'file') == 2
load(name)
% Prev_l_cont_match = l_cont_match;
l_cont_match = [];
% Prev_lum_cont_match = lum_cont_match;
lum_cont_match = [];
% Prev_lumMod_match = lumMod_match;
lumMod_match = [];
else
Prev_l_cont_match = [];
Prev_lum_cont_match = [];
Prev_lumMod_match = [];
end
%%
cd(a); % return to folder where the program is
% Calib_Dire = cd('/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/001 After Image GUI Project');
load colorCalFile1.mat
fprintf('\nLast calibration was %s\n', describe.date);
pix = pix/1001;
maxLum = 20; %cd/m^2
lumMod_initial = [.6 .7 .8 1 ];
lCont_initial = [0.02 0.026 0.034 .04];
sCont = [.35 .5 .65 .8];
% sCont = [.5 .5 .5 .5];
nCont = length(sCont);
% white = [.665 1];
blackLut = [0 0 0];
redLut = [.8 0 0];
% % Bckg_Chro = [.665 1.353
% % .665 .647
% % .647 1
% % .683 1]; % 4 rows X 2 columns
%% set up psych toolbox
%set up 10 bit color
PsychImaging('PrepareConfiguration');
%PsychImaging('AddTask', 'General', 'EnableNative10BitFrameBuffer',1); %the 0 is turn off dithering?
expScreen = 1;
%create white LUT
% % % wLMS(1,1) = white(1,1)*maxLum;
% % % wLMS(1,2) = (1-white(1,1))*maxLum;
% % % wLMS(1,3) = white(1,2)*maxLum;
% % % wXYZ(1,:) = LMS_to_XYZ(wLMS(1,:));
% % % wRGB(1,:) = XYZ_to_RGB(wXYZ(1,:), maxPhosXYZ);
% % % wRGB(1,1) = pix(dsearchn(redProp(:), wRGB(1,1)))*hfpRG;
% % % wRGB(1,2) = pix(dsearchn(grnProp(:), wRGB(1,2)));
% % % wRGB(1,3) = pix(dsearchn(blueProp(:), wRGB(1,3)))*hfpBG;
[window, windowRect] = PsychImaging('OpenWindow', expScreen, [0 0 0], [], [], []); %
%Screen('OpenWindow',0, [0 0 0]); %makes main screen dark
%PsychImaging('OpenWindow', expScreen, wRGB);
[xcent,ycent] = RectCenter(windowRect);
center = [xcent ycent];
%% TIMING
%find frames per second
ifi = Screen('GetFlipInterval', window);% Measure the vertical refresh rate of the monitor
topPriorityLevel = MaxPriority(window);% Retreive the maximum priority number
% % % % numSecs = 16; %in seconds, total presentation time
hfpFreq = 4.6; hfpPeriod = 1/hfpFreq;
numSecs = hfpPeriod; %in seconds, total presentation time
framesPerSec = round(1/ifi);
nFrames = numSecs * framesPerSec;
% waitframes = floor(framesPerSec/hfpFreq); %number of frames to wait between refresh
nFrames = round(hfpPeriod /ifi) ;
% % % % waitframes = 1; %number of frames to wait between refresh
waitframes = 1; %number of frames to wait between refresh
%% Stimulus Size Parameters
circleDeg = 3.6;
clockPt = 0.1;
% code assumes 1 pixel = 1 arc min
pixPerDeg = 35; %at a distance of 57 cm
circlePix = circleDeg*pixPerDeg;
clockPix = clockPt*pixPerDeg;
tstcircle = [xcent - circlePix/2 ycent - circlePix/2 xcent + circlePix/2 ycent + circlePix/2];
WaitSecs(1);
%run experiment
Priority(topPriorityLevel);
vbl = Screen('Flip', window);
%%/////////////////////////////////////////////////////////////////////////
%%/ TRIALS
%%/////////////////////////////////////////////////////////////////////////
stepSize_l = 0.0005;
stepSize_lum = 0.01;
order = randi(1);
count = 0;
nRep = 3; % in this case is always three
for iChro = 1:size(Bckg_Chro,1)
wLMS(1,1) = Bckg_Chro(iChro,1)*maxLum;
wLMS(1,2) = (1-Bckg_Chro(iChro,1))*maxLum;
wLMS(1,3) = Bckg_Chro(iChro,2)*maxLum;
wXYZ(1,:) = LMS_to_XYZ(wLMS(1,:));
wRGB(1,:) = XYZ_to_RGB(wXYZ(1,:), maxPhosXYZ);
wRGB(1,1) = pix(dsearchn(redProp(:), wRGB(1,1)))*hfpRG;
wRGB(1,2) = pix(dsearchn(grnProp(:), wRGB(1,2)));
wRGB(1,3) = pix(dsearchn(blueProp(:), wRGB(1,3)))*hfpBG;
Screen('FillRect', window, wRGB);
Screen('Flip',window)
WaitSecs(AdaptTime)
for iaxis = curr_cond(1):curr_cond(end); % 1 means lCont and 2 means lumCont
for icont = 1:nCont % number of contrast to match
for irep = 1:nRep %
FlushEvents('mouseDown','keyDown');
order = de2bi(count)
order = order(1); %use the last digit of the binary number (that is the first to matlab) so it switch between 0 and 1
if iaxis == 1
cont_values = linspace(lCont_initial(icont),lCont_initial(icont)-0.02,21);
initial_idx = randi(length(cont_values))
lCont = cont_values(initial_idx)
elseif iaxis == 2
cont_values = linspace(lumMod_initial(icont),lumMod_initial(icont)-.5,21);
initial_idx = randi(length(cont_values))
lumMod = cont_values(initial_idx)
end
%%/////////////////////////////////////////////////////////////////////////
%%/ SUBJECT INPUTS (RESPONSES)
%%/////////////////////////////////////////////////////////////////////////
DoneMatch = 0;
while ~DoneMatch %look for key presses and put up stimulus
[ keyIsDown, timeSecs, keyCode ] = KbCheck;
if(CharAvail) % check for keypress, record if key=1 or 2 or 3
[char] = GetChar;
switch char
case '8'
DoneMatch = 1;
clc
switch iaxis
case 1
l_cont_match (irep, icont) = lCont
case 2
lumMod_match (irep, icont) = lumMod
lum_cont_match (irep, icont) = (lumMod) / maxLum
end
case '6'
switch iaxis
case 1
lCont = lCont + stepSize_l
case 2
lumMod = lumMod + stepSize_lum
end
case '4'
switch iaxis
case 1
lCont = lCont - stepSize_l
if lt(lCont,0)
lCont=0
end
case 2
lumMod = lumMod - stepSize_lum
if lt(lumMod,0)
lumMod=0
end
end
case '9'
switch iaxis
case 1
lCont = lCont + stepSize_l/5;
case 2
lumMod = lumMod + stepSize_lum/10;
end
case '7'
switch iaxis
case 1
lCont = lCont - stepSize_l/5;
if lt(lCont,0)
lCont=0
end
case 2
lumMod = lumMod - stepSize_lum/10;
if lt(lumMod,0)
lumMod=0
end
end
end
FlushEvents('keyDown');
end
%%/////////////////////////////////////////////////////////////////////////
%%/ SET STIMULUS
%%/////////////////////////////////////////////////////////////////////////
%create colors depending on contrast
switch iaxis
case 1
l = [Bckg_Chro(iChro,1)+(Bckg_Chro(iChro,1)*lCont) Bckg_Chro(iChro,2) maxLum
Bckg_Chro(iChro,1)-(Bckg_Chro(iChro,1)*lCont) Bckg_Chro(iChro,2) maxLum]; %+l, -l
colLut = l;
case 2
lum = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2) maxLum-lumMod
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2) maxLum+lumMod];
colLut = lum;
end
s = [Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)+(Bckg_Chro(iChro,2)*sCont(icont)) maxLum
Bckg_Chro(iChro,1) Bckg_Chro(iChro,2)-(Bckg_Chro(iChro,2)*sCont(icont)) maxLum];%+s, -s
colLut_R = s;
%LMS values of each color, ls to LMS
for iLMS = 1:2
cLMS(iLMS,1) = colLut(iLMS,1)*colLut(iLMS, 3);
cLMS(iLMS,2) = (1-colLut(iLMS,1))*colLut(iLMS, 3);
cLMS(iLMS,3) = colLut(iLMS,2)*colLut(iLMS, 3);
cLMS_R(iLMS,1) = colLut_R(iLMS,1)*colLut_R(iLMS, 3);
cLMS_R(iLMS,2) = (1-colLut_R(iLMS,1))*colLut_R(iLMS, 3);
cLMS_R(iLMS,3) = colLut_R(iLMS,2)*colLut_R(iLMS, 3);
end
%XYZ values for each
for iXYZ = 1:length(cLMS(:,1))
cXYZ(iXYZ,:) = LMS_to_XYZ(cLMS(iXYZ,:));
cXYZ_R(iXYZ,:) = LMS_to_XYZ(cLMS_R(iXYZ,:));
end
%use lut to find corrected monitor RGB values for each rgb color
for iRGB = 1:length(cXYZ(:,1))
cRGB(iRGB,:) = XYZ_to_RGB(cXYZ(iRGB,:), maxPhosXYZ);
cRGB(iRGB,1) = pix(dsearchn(redProp(:), cRGB(iRGB,1)))*hfpRG;
cRGB(iRGB,2) = pix(dsearchn(grnProp(:), cRGB(iRGB,2)));
cRGB(iRGB,3) = pix(dsearchn(blueProp(:), cRGB(iRGB,3)))*hfpBG;
cRGB_R(iRGB,:) = XYZ_to_RGB(cXYZ_R(iRGB,:), maxPhosXYZ);
cRGB_R(iRGB,1) = pix(dsearchn(redProp(:), cRGB_R(iRGB,1)))*hfpRG;
cRGB_R(iRGB,2) = pix(dsearchn(grnProp(:), cRGB_R(iRGB,2)));
cRGB_R(iRGB,3) = pix(dsearchn(blueProp(:), cRGB_R(iRGB,3)))*hfpBG;
end
Left = zeros(nFrames,3);
Right = zeros(nFrames,3);
for iRamp = 1:3 %for 3 phosophors
Left(:,iRamp) = sinspaceOneCycle(wRGB(1,iRamp), cRGB(1,iRamp), nFrames);
Right(:,iRamp) = sinspaceOneCycle(wRGB(1,iRamp), cRGB_R(1,iRamp), nFrames);
end
%%/////////////////////////////////////////////////////////////////////////
%%/ DISPLAY STIMULUS
%%/////////////////////////////////////////////////////////////////////////
startT=GetSecs();
elapsedT=0;
for iFrames = 1:nFrames
switch order
case 0
%LEFT SEMICIRCLE
Screen('FillArc', window, Left(iFrames,:), tstcircle, 180, 180);
% vbl = Screen('Flip', window, vbl + (waitframes - 0.5) * ifi);
Screen('FillArc', window, Right(iFrames,:), tstcircle, 0, 180);
vbl = Screen('Flip', window, vbl + (waitframes - 0.5) * ifi);
case 1
%LEFT SEMICIRCLE
Screen('FillArc', window, Right(iFrames,:), tstcircle, 180, 180);
% vbl = Screen('Flip', window, vbl + (waitframes - 0.5) * ifi);
Screen('FillArc', window, Left(iFrames,:), tstcircle, 0, 180);
vbl = Screen('Flip', window, vbl + (waitframes - 0.5) * ifi);
end
end
end %while done
count = count+1;
elapsedT=GetSecs()-startT;
FreqCheck = 1/elapsedT;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CHECK STOP BUTTON PUSHING? %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
yesno=evalin('base','Stop_Press')
if yesno==1
return
end
% - - - - - - - - - - - - - - - - - - - - - - - - - -
end % irep
end %icont
end % iaxis
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FINAL VARIABLES %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
lCont_avg = median(l_cont_match,1); lCont_sd = std(l_cont_match,1);
lumCont_avg = median(lum_cont_match,1); lumCont_sd = std(lum_cont_match,1);
lumMod_avg = median(lumMod_match);
Avg_MatchCont = [lCont_avg ;
lumCont_avg];
TodayDate = datevec(date);
for ii=1:nRep
CoMatch_Date(ii,1:3) = TodayDate(1:3) ;
end
Dated_l_cont_match = [CoMatch_Date repelem(Bckg_Chro(iChro,:),nRep,1) l_cont_match];
Dated_lum_cont_match = [CoMatch_Date repelem(Bckg_Chro(iChro,:),nRep,1) lum_cont_match];
Dated_lumMod_match = [CoMatch_Date repelem(Bckg_Chro(iChro,:),nRep,1) lumMod_match];
if ~isempty(l_cont_match)
Prev_l_cont_match = [Prev_l_cont_match ;
Dated_l_cont_match];
end
if ~isempty(lum_cont_match)
Prev_lum_cont_match = [Prev_lum_cont_match ;
Dated_lum_cont_match];
Prev_lumMod_match = [Prev_lumMod_match ;
Dated_lumMod_match];
end
if gt(size(Prev_l_cont_match,1),4)% Final values of contrast for the afterimage program
idx_l = find(and(Prev_l_cont_match(:,4) == Bckg_Chro(iChro,1), Prev_l_cont_match(:,5) == Bckg_Chro(iChro,2) ))
idx_lum = find(and(Prev_lum_cont_match(:,4) == Bckg_Chro(iChro,1), Prev_lum_cont_match(:,5) == Bckg_Chro(iChro,2) ))
idx_lumMod = find(and(Prev_lumMod_match(:,4) == Bckg_Chro(iChro,1), Prev_lumMod_match(:,5) == Bckg_Chro(iChro,2) ))
Final_lCont_avg(iChro,:) = [Bckg_Chro(iChro,:) median(Prev_l_cont_match(idx_l,end-3:end))];
Final_lumCont_avg(iChro,:) = [Bckg_Chro(iChro,:) median(Prev_lum_cont_match(idx_lum,end-3:end))];
Final_lumMod_avg(iChro,:) = [Bckg_Chro(iChro,:) median(Prev_lumMod_match(idx_lumMod,end-3:end))];
else
Msg = 'MORE MEASUREMENTS ARE NEEDEED'
Final_lCont_avg = [];
Final_lumCont_avg = [];
Final_lumMod_avg = [];
end
Final_sCont_ref = sCont;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PLOT AND SAVE %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f(iChro) = figure
if ~isempty(l_cont_match)
errorbar(sCont,lCont_avg,lCont_sd,'r*--','MarkerSize',15); hold on
end
if ~isempty(lum_cont_match)
errorbar(sCont,lumCont_avg,lumCont_sd,'k*--','MarkerSize',15);
end
switch iChro
case 1
set(f(iChro), 'Position', [1100 770 500 500]);
title('North (blueish)')
case 2
set(f(iChro), 'Position', [1100 170 500 500]);
title('South (yellowish)')
case 3
set(f(iChro), 'Position', [400 470 500 500]);
title('West (greenish)')
case 4
set(f(iChro), 'Position', [1700 470 500 500]);
title('East (redish)')
end
end% iChro
Screen('CloseAll')
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
save(saveFile,'Final_lCont_avg','Final_lumCont_avg','Final_lumMod_avg','Final_sCont_ref',...
'Prev_l_cont_match','Prev_lum_cont_match','Prev_lumMod_match')
sca
figure(1);figure(2);figure(3);figure(4); %bring figures to front
catch
warndlg('The program failed to run. Try again.')
return
end
end

99
002 After Image GUI Project/Disp_Color.m

@ -0,0 +1,99 @@
function Disp_Color(l_value,s_value,hfpRG,hfpBG)
commandwindow; % open this, and the cursor will appear in the command window
% %% Choose program
% EEW_StdObsANDSubj = 0;
% EEW_Subj = 1;
%%
% Check that Psychtoolbox is properly installed, and switch color range to normalized 0 - 1 range:
PsychDefaultSetup(2);
%% Start Experiment
a = cd;
theDate = fix(clock);
% subName = 'DC'%input(sprintf('\nEnter Subject Initials: '))
duration= 5; % sec
% %% Color information, load hfp data and color calibration
%
% aa = cd('/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/A Outputs');
% hfpFile = sprintf('%sHFP', subName);
% load(hfpFile, '-mat')
% hfpRG = rg_avg;
% hfpBG = bg_avg;
% hfpRG = .89;
% hfpBG = .97 ;
%%
cd(a); % return to folder where the program is
Calib_Dire = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
load colorCalFile1.mat
fprintf('\nLast calibrationS was %s\n', describe.date);
pix = pix/1001;
maxLum = 20; %cd/m^2
l_s_pair = [l_value s_value];
blackLut = [0 0 0];
redLut = [.8 0 0];
%% set up psych toolbox
%set up 10 bit color
PsychImaging('PrepareConfiguration');
%PsychImaging('AddTask', 'General', 'EnableNative10BitFrameBuffer',1); %the 0 is turn off dithering?
expScreen = 1;
%create white LUT
wLMS(1,1) = .665*maxLum;%l_s_pair(1,1)*maxLum;
wLMS(1,2) = (1-.665)*maxLum;%(1-l_s_pair(1,1))*maxLum;
wLMS(1,3) = 1*maxLum;%l_s_pair(1,2)*maxLum;
wXYZ(1,:) = LMS_to_XYZ(wLMS(1,:));
wRGB(1,:) = XYZ_to_RGB(wXYZ(1,:), maxPhosXYZ);
wRGB(1,1) = pix(dsearchn(redProp(:), wRGB(1,1)))%*hfpRG;
wRGB(1,2) = pix(dsearchn(grnProp(:), wRGB(1,2)));
wRGB(1,3) = pix(dsearchn(blueProp(:), wRGB(1,3)))%*hfpBG;
[window, windowRect] = PsychImaging('OpenWindow', expScreen, [0 0 0]); %EEW for standard observer
%% Circle parameters
[xCenter, yCenter] = RectCenter(windowRect);% Get the centre coordinate of the window
baseRect = [0 0 300 300]; % Rect of 200 by 250 pixels
maxDiameter = max(baseRect) * 1.01;% For Ovals we set a miximum diameter up to which it is perfect for
centeredRect = CenterRectOnPointd(baseRect, xCenter, yCenter);% Center the rectangle on the centre of the screen
%%
Screen('FillRect', window, [0 0 0], windowRect);% dark screen
Screen('Flip', window);
WaitSecs(1)
% % if EEW_StdObsANDSubj
% Screen('FillOval', window, wRGB, centeredRect, maxDiameter); % Draw the rect to the screen
% Screen('Flip', window);
% WaitSecs(duration)
%
% % end
% if EEW_Subj
wRGB(1,1) = wRGB(1,1)*hfpRG;
wRGB(1,2) = wRGB(1,2);
wRGB(1,3) = wRGB(1,3)*hfpBG;
%
Screen('FillOval', window, wRGB, centeredRect, maxDiameter); % Draw the rect to the screen
Screen('Flip', window);
WaitSecs(duration)
%
% end
% KbStrokeWait;
Screen('CloseAll')
end

8
002 After Image GUI Project/Exp_Conditions.txt

@ -0,0 +1,8 @@
Variable,Values
Lum,20 littleL,0.665 littleS,1 l_axis,true s_axis,true l_s_45,true l_s_135,true
lum_axis,true
lum_l_45,true
lum_l_135,true
lum_s_45,true
lum_s_135,true
N_repet,3

303
002 After Image GUI Project/HFP_session.m

@ -0,0 +1,303 @@
function HFP_session(subName,curr_cond)
% HFP Code for Elliott Lab
% Written by SLE 3/24/17
% Modified by CPF
a = cd; % folder where the program is.
hfpDate = date;
saveFile = sprintf('%sHFP',subName);
numRep = 3; %number of repetitions
Calib_Dire = cd('/Users/clemente/Desktop/AfterImage Programs/002 After Image GUI Project');
%load in monitor calibration information & color set parameters
load colorCalFile1.mat
fprintf('\nLast calibration was %s\n', describe.date);
pixDec = pix/length(pix); %converts 1001 numbers to decimals
lum = 5; %in cd/m^2
rgbMat(:,4) = pix;
rgbMat(:,1) = redProp(:)*maxPhosXYZ(1,2);
rgbMat(:,2) = grnProp(:)*maxPhosXYZ(2,2);
rgbMat(:,3) = blueProp(:)*maxPhosXYZ(3,2);
for i=1:3
settings(i) = pix(dsearchn(rgbMat(:,i), lum));
end
%gives an index into the phosphor table to find a value btw 0-1
%correponding to that luminance
initial_RED = settings(1)
initial_GREEN = settings(2)
initial_BLUE = settings(3)
%stepSize is based on the total number of unique luminance values in the rgbMat so we don't get stuck pushing the button to move the luminance of 1 phosphor
stepSize = 4;
%% Load previous HFP values
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
name = sprintf('%sHFP.mat', subName);
if exist(name, 'file') == 2
load(name)
% bg = [];
% rg = [];
% br = [];
% br_check = [];
else
Prev_bg = []; bg = [];
Prev_rg = []; rg = [];
Prev_br = []; br = [];
Prev_brcheck = []; br_check = [];
end
%% Set up toolbox variables
% switch color range to normalized 0 - 1 range:
% PsychDefaultSetup(2);
expScreen = 1;
[window, windowRect] = PsychImaging('OpenWindow', expScreen, [0 0 0], [], [], []);
% Screen('OpenWindow',0, [0 0 0]); %makes main screen dark
%PsychImaging('OpenWindow', expScreen, wRGB);
[xcent,ycent] = RectCenter(windowRect);
center = [xcent ycent];
%% TIMING
%find frames per second
ifi = Screen('GetFlipInterval', window);% Measure the vertical refresh rate of the monitor
topPriorityLevel = MaxPriority(window);% Retreive the maximum priority number
framesPerSec = round(1/ifi);
hfpFreq = 15;
waitframes = floor(framesPerSec/hfpFreq); %number of frames to wait between refresh
%freqRefresh = ifi*framesPerSec/hfpFreq;
%% Stimulus Size Parameters
circleDeg = 3.6; %was 1.5 in Sarah Program
pixPerDeg =35;% was 60 in Sarah Program
circlePix = circleDeg*pixPerDeg;
tstcircle = [xcent - circlePix/2 ycent - circlePix/2 xcent + circlePix/2 ycent + circlePix/2];
cd(a); % return to folder where the program is
%run experiment
Priority(topPriorityLevel);
% for iRepeat = 1:numRep
stim_order = [1 1 1 2 2 2 3 3 3];%randperm(3);
keypress = 0;
%Speak('Setting %i', iRepeat)
commandwindow;
for j = 1:9
vbl = Screen('Flip', window);
switch stim_order(j)
case 1 %RG
current_RED = initial_RED;
colClut_one = [pixDec(current_RED) 0 0];
colClut_two = [0 pixDec(initial_GREEN) 0];
case 2 %BG
current_BLUE = initial_BLUE;
colClut_one = [0 0 pixDec(current_BLUE)];
colClut_two = [0 pixDec(initial_GREEN) 0];
case 3 %RB
current_RED = initial_RED;
colClut_one = [0 0 pixDec(initial_BLUE)];
colClut_two = [pixDec(current_RED) 0 0];
end
%ListenChar(2);
% % % % BeginMatch = 0;
% Speak('press start to begin')
% % % % while ~BeginMatch %wait for initial key press
% % % % if(CharAvail) % check for keypress, record if key=4
% % % % [char] = GetChar;
% % % % if char =='8'
% % % % BeginMatch = 1;
% % % % end
% % % % FlushEvents('keyDown');
% % % % end
% % % % end
FlushEvents('keyDown');
%Speak('Next Session')
DoneMatch = 0;
count = 0; %count the number of frames
while ~DoneMatch %look for key presses and put up stimulus
[ keyIsDown, timeSecs, keyCode ] = KbCheck;
if(CharAvail) % check for keypress, record if key=1 or 2 or 3
[char] = GetChar;
switch char
case '8'
DoneMatch = 1;
switch stim_order(j)
case 1 %RG
rg(j) = rgbMat(current_RED,1)/rgbMat(initial_GREEN,2)
case 2 %BG
bg(j-3) = rgbMat(current_BLUE,3)/rgbMat(initial_GREEN,2)
case 3 %BR
br(j-6) = rgbMat(initial_BLUE,3)/rgbMat(current_RED,1)
end
case '6'
switch stim_order(j)
case 1 %RG
current_RED = current_RED + stepSize
if current_RED > 1001
beep%Speak('setting limit');
current_RED = 1001;
end
colClut_one = [pixDec(current_RED) 0 0];
colClut_two = [0 pixDec(initial_GREEN) 0];
case 2 %BG
current_BLUE = current_BLUE + stepSize
if current_BLUE > 1001
beep%Speak('setting limit');
current_BLUE = 1001;
end
colClut_one = [0 0 pixDec(current_BLUE)];
colClut_two = [0 pixDec(initial_GREEN) 0];
case 3 %BR
current_RED = current_RED + stepSize
if current_RED > 1001
beep%Speak('setting limit');
current_RED = 1001;
end
colClut_one = [0 0 pixDec(initial_BLUE)];
colClut_two = [pixDec(current_RED) 0 0];
end
case '9'
switch stim_order(j)
case 1 %RG
current_RED = current_RED + stepSize/4
if current_RED > 1001
beep%Speak('setting limit');
current_RED = 1001;
end
colClut_one = [pixDec(current_RED) 0 0];
colClut_two = [0 pixDec(initial_GREEN) 0];
case 2 %BG
current_BLUE = current_BLUE + stepSize/4
if current_BLUE > 1001
beep%Speak('setting limit');
current_BLUE = 1001;
end
colClut_one = [0 0 pixDec(current_BLUE)];
colClut_two = [0 pixDec(initial_GREEN) 0];
case 3 %BR
current_RED = current_RED + stepSize/4
if current_RED > 1001
beep%Speak('setting limit');
current_RED = 1001;
end
colClut_one = [0 0 pixDec(initial_BLUE)];
colClut_two = [pixDec(current_RED) 0 0];
end
case '4'
switch stim_order(j)
case 1 %RG
current_RED = current_RED - stepSize
if current_RED <= 1
beep%speak('setting limit');
current_RED = 1;
% else
end
colClut_one = [pixDec(current_RED) 0 0];
colClut_two = [0 pixDec(initial_GREEN) 0];
case 2 %BG
current_BLUE = current_BLUE - stepSize
if current_BLUE <= 1
beep%speak('setting limit')
current_BLUE = 1;
% else
end
colClut_one = [0 0 pixDec(current_BLUE)];
colClut_two = [0 pixDec(initial_GREEN) 0];
case 3 %BR
current_RED = current_RED - stepSize
if current_RED <= 1
beep%speak('setting limit')
current_RED = 1;
% else
end
colClut_one = [0 0 pixDec(initial_BLUE)];
colClut_two = [pixDec(current_RED) 0 0];
end
case '7'
switch stim_order(j)
case 1 %RG
current_RED = current_RED - stepSize/4
if current_RED <= 1
beep%speak('setting limit');
current_RED = 1;
% else
end
colClut_one = [pixDec(current_RED) 0 0];
colClut_two = [0 pixDec(initial_GREEN) 0];
case 2 %BG
current_BLUE = current_BLUE - stepSize/4
if current_BLUE <= 1
beep%speak('setting limit')
current_BLUE = 1;
% else
end
colClut_one = [0 0 pixDec(current_BLUE)];
colClut_two = [0 pixDec(initial_GREEN) 0];
case 3 %BR
current_RED = current_RED - stepSize/4
if current_RED <= 1
beep%speak('setting limit')
current_RED = 1;
% else
end
colClut_one = [0 0 pixDec(initial_BLUE)];
colClut_two = [pixDec(current_RED) 0 0];
end
end
FlushEvents('keyDown');
end
Screen('FillOval', window, colClut_one, tstcircle);
vbl = Screen('Flip', window, vbl + (waitframes - 0.5) * ifi);
Screen('FillOval', window, colClut_two, tstcircle);
vbl = Screen('Flip', window, vbl + (waitframes - 0.5) * ifi);
end %while done
Screen('FillOval', window, [0 0 0], windowRect);
Screen('Flip', window);
pause(1);
end %for j
for irep = 1:3
br_check(irep) = bg(irep)/rg(irep);
end
% end %i
Priority(0)
%ListenChar(0);
sca
fprintf('\n\n')
% rg_avg = median(rg(1,2:3));
% bg_avg = median(bg(1,2:3));
% rb_avg = median(br(1,2:3));
Prev_bg = [Prev_bg ; bg];
Prev_rg = [Prev_rg ; rg];
Prev_br = [Prev_br ; br];
Prev_brcheck = [Prev_brcheck ; br_check];
if ge(size(Prev_bg,1),3);
rg_avg = median(reshape(Prev_rg(end-2:end,2:3),6,1));
bg_avg = median(reshape(Prev_bg(end-2:end,2:3),6,1));
rb_avg = median(reshape(Prev_br(end-2:end,2:3),6,1));
else
rg_avg = [];
bg_avg = [];
rb_avg = [];
end
% Save to mat file
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
saveCmd = ['save ' saveFile ' hfpDate rg_avg bg_avg rb_avg Prev_rg Prev_bg Prev_br Prev_brcheck'];
eval(saveCmd)
end

39
002 After Image GUI Project/LMS_to_XYZ.m

@ -0,0 +1,39 @@
function XYZ = LMS_to_XYZ(LMS)
% function XYZ = Color_Convert_LMS_to_XYZ(LMS)
%
% Converts fron Cone Activation (LMS) to CIE 1931 Tristimulus Value (XYZ)
%
% Takes: LMS (N, 3) - LMS coordinates
% Returns: XYZ (N, 3) - XYZ coordinates
% Dependencies: Variable_Report.m
%
% Created 2015-07-09 by KCM
%
% Updated 2015-07-09 by KCM
%
%Updated 2015-08-18 by SLE to be consistent with UC with s scaled to 1
%% Arguments
if ~exist('LMS', 'var') || isempty(LMS)
fprintf(char(strcat({'\nColor_Convert_LMS_to_XYZ: '}, {'''LMS'' must be provided!\n\n'})))
XYZ = []; return
end
if ~ismatrix(LMS) || size(LMS, 2) ~= 3
fprintf(char(strcat({'\nColor_Convert_LMS_to_XYZ: '}, {'''LMS'' must have size (N, 3)!\n\n'})))
XYZ = []; return
end
if sum(sum(~isfinite(LMS))) || sum(sum(~isreal(LMS)))
fprintf(char(strcat({'\nColor_Convert_LMS_to_XYZ: '}, ...
{'''LMS'' must be finite and real!\n\n'})))
XYZ = []; return
end
%% Convert
XYZ = [2.9448 .* LMS(:, 1) - 3.5010 .* LMS(:, 2) + 0.2068 .* LMS(:, 3), ... % X
1 .* LMS(:, 1) + 1 .* LMS(:, 2) + 0 .* LMS(:, 3), ... % Y
0 .* LMS(:, 1) + 0 .* LMS(:, 2) + 0.9765 .* LMS(:, 3)]; clear LMS % Z
%
% %% Variable Report (Housecleaning: for spotting uncleared variables. Omit if desired)
% Variable_Report(whos, 'XYZ')
end

BIN
002 After Image GUI Project/Program Compiled/.DS_Store vendored

Binary file not shown.

39
002 After Image GUI Project/Program Compiled/PackagingLog.html

@ -0,0 +1,39 @@
<html><meta charset="UTF-8"><pre>
<font color=blue>mcc -o tvp_GENERATOR -W main:tvp_GENERATOR -T link:exe -d '/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/002 After Image GUI Project/Program Compiled/for_testing' -v '/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/002 After Image GUI Project/AppTEST.mlapp' </font>
Compiler version: 6.2 (R2016a)
Dependency analysis by REQUIREMENTS.
Name is nonexistent or not a directory: /Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/002 After Image GUI Project
[Warning: Directory permission denied: /Users/inaki/Documents/Color Afterimages]
[Warning: Adding path
"/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background
Afterimage/1 Programs/002 After Image GUI Project" to Compiler path instance.]
Parsing file "/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/002 After Image GUI Project/AppTEST.mlapp"
(Referenced from: "Compiler Command Line").
Deleting 11 temporary MEX authorization files.
Removing: '/tmp/020341yliQ7_8244.auth'.
Removing: '/tmp/02034TqWg50_8244.auth'.
Removing: '/tmp/02034ZEw9Wc_8244.auth'.
Removing: '/tmp/02034lnprP3_8244.auth'.
Removing: '/tmp/02034Lw9dR6_8244.auth'.
Removing: '/tmp/02034rmBu8Q_8244.auth'.
Removing: '/tmp/020344qOOri_8244.auth'.
Removing: '/tmp/02034aVx57k_8244.auth'.
Removing: '/tmp/02034hgoEMd_8244.auth'.
Removing: '/tmp/020340Cm2kq_8244.auth'.
Removing: '/tmp/02034Nyhm5R_8244.auth'.
Generating file "/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/002 After Image GUI Project/Program Compiled/for_testing/readme.txt".
Generating file "/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/002 After Image GUI Project/Program Compiled/for_testing/run_tvp_GENERATOR.sh".
<font color=blue>Packaging...</font>
Adding custom icon /Applications/MATLAB_R2016a.app/toolbox/compiler/Resources/default_icon.icns to /Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/002 After Image GUI Project/Program Compiled/for_testing/tvp_GENERATOR.app.
Creating the bundle...
Copying /Applications/MATLAB_R2016a.app/toolbox/compiler/maci64/setup.app to /Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app.
Copying /Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/002 After Image GUI Project/Program Compiled/for_redistribution/bundle.zip to /Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/Resources/bundle.zip.
Copying /Applications/MATLAB_R2016a.app/toolbox/compiler/Resources/default_splash.png to /Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/Resources/splash.png.
Copying /Applications/MATLAB_R2016a.app/toolbox/compiler/Resources/default_icon.icns to /Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/Resources/installer.icns.
Copying /Users/clemente/.installAgent9.0.1/maci64/InstallAgent_35000_35010.zip to /Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/Resources/InstallAgent_35000_35010.zip.
Self contained installer created at /Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app.
Packaging complete.
Elapsed packaging time was: 3 minutes and 29 seconds.
</pre></html>

32
002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/Info.plist

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>setup</string>
<key>CFBundleIconFile</key>
<string>installer.icns</string>
<key>CFBundleIdentifier</key>
<string>com.mathworks.toolbox.compiler.setup</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>10.4</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2013 __MyCompanyName__. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

BIN
002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/MacOS/setup

Binary file not shown.

20
002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/MacOS/setup.dSYM/Contents/Info.plist

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.com.mathworks.toolbox.compiler.setup</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

BIN
002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/MacOS/setup.dSYM/Contents/Resources/DWARF/setup

Binary file not shown.

BIN
002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/Resources/InstallAgent_35000_35010.zip

Binary file not shown.

BIN
002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/Resources/bundle.zip

Binary file not shown.

BIN
002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/Resources/en.lproj/MainMenu.nib generated

Binary file not shown.

BIN
002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/Resources/installer.icns

Binary file not shown.

BIN
002 After Image GUI Project/Program Compiled/for_redistribution/MyAppInstaller_mcr.app/Contents/Resources/splash.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
002 After Image GUI Project/Program Compiled/for_redistribution_files_only/default_icon.icns

Binary file not shown.

120
002 After Image GUI Project/Program Compiled/for_redistribution_files_only/readme.txt

@ -0,0 +1,120 @@
MATLAB Compiler
1. Prerequisites for Deployment
. Verify the MATLAB Runtime is installed and ensure you
have installed version 9.0.1 (R2016a).
. If the MATLAB Runtime is not installed, do the following:
(1) enter
>>mcrinstaller
at MATLAB prompt. The MCRINSTALLER command displays the
location of the MATLAB Runtime installer.
(2) run the MATLAB Runtime installer.
Or download the Macintosh version of the MATLAB Runtime for R2016a
from the MathWorks Web site by navigating to
http://www.mathworks.com/products/compiler/mcr/index.html
For more information about the MATLAB Runtime and the MATLAB Runtime installer, see
Package and Distribute in the MATLAB Compiler documentation
in the MathWorks Documentation Center.
NOTE: You will need administrator rights to run MCRInstaller.
2. Files to Deploy and Package
Files to package for Standalone
================================
-run_tvp_GENERATOR.sh (shell script for temporarily setting environment variables and
executing the application)
-to run the shell script, type
./run_tvp_GENERATOR.sh <mcr_directory> <argument_list>
at Linux or Mac command prompt. <mcr_directory> is the directory
where version 9.0.1 of the MATLAB Runtime is installed or the directory where
MATLAB is installed on the machine. <argument_list> is all the
arguments you want to pass to your application. For example,
If you have version 9.0.1 of the MATLAB Runtime installed in
/mathworks/home/application/v901, run the shell script as:
./run_tvp_GENERATOR.sh /mathworks/home/application/v901
If you have MATLAB installed in /mathworks/devel/application/matlab,
run the shell script as:
./run_tvp_GENERATOR.sh /mathworks/devel/application/matlab
-MCRInstaller.zip
-if end users are unable to download the MATLAB Runtime using the above
link, include it when building your component by clicking
the "Runtime downloaded from web" link in the Deployment Tool
-The Macintosh bundle directory structure tvp_GENERATOR.app
-this can be gathered up using the zip command
zip -r tvp_GENERATOR.zip tvp_GENERATOR.app
or the tar command
tar -cvf tvp_GENERATOR.tar tvp_GENERATOR.app
-This readme file
3. Definitions
For information on deployment terminology, go to
http://www.mathworks.com/help. Select MATLAB Compiler >
Getting Started > About Application Deployment >
Deployment Product Terms in the MathWorks Documentation
Center.
4. Appendix
A. Mac systems:
In the following directions, replace MCR_ROOT by the directory where the MATLAB Runtime
is installed on the target machine.
If the environment variable DYLD_LIBRARY_PATH is undefined, set it to the concatenation
of the following strings:
MCR_ROOT/v901/runtime/maci64:
MCR_ROOT/v901/sys/os/maci64:
MCR_ROOT/v901/bin/maci64
If it is defined, set it to the concatenation of these strings:
${LD_LIBRARY_PATH}:
MCR_ROOT/v901/runtime/maci64:
MCR_ROOT/v901/sys/os/maci64:
MCR_ROOT/v901/bin/maci64
For more detail information about setting the MATLAB Runtime paths, see Package and
Distribute in the MATLAB Compiler documentation in the MathWorks Documentation Center.
NOTE: To make these changes persistent after logout on Linux
or Mac machines, modify the .cshrc file to include this
setenv command.
NOTE: The environment variable syntax utilizes forward
slashes (/), delimited by colons (:).
NOTE: When deploying standalone applications, it is possible
to run the shell script file run_tvp_GENERATOR.sh
instead of setting environment variables. See
section 2 "Files to Deploy and Package".
5. Launching of application using Macintosh finder.
If the application is purely graphical, that is, it doesn't read from standard in or
write to standard out or standard error, it may be launched in the finder just like any
other Macintosh application.

32
002 After Image GUI Project/Program Compiled/for_redistribution_files_only/run_tvp_GENERATOR.sh

@ -0,0 +1,32 @@
#!/bin/sh
# script for execution of deployed applications
#
# Sets up the MATLAB Runtime environment for the current $ARCH and executes
# the specified command.
#
exe_name=$0
exe_dir=`dirname "$0"`
echo "------------------------------------------"
if [ "x$1" = "x" ]; then
echo Usage:
echo $0 \<deployedMCRroot\> args
else
echo Setting up environment variables
MCRROOT="$1"
echo ---
DYLD_LIBRARY_PATH=.:${MCRROOT}/runtime/maci64 ;
DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:${MCRROOT}/bin/maci64 ;
DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:${MCRROOT}/sys/os/maci64;
export DYLD_LIBRARY_PATH;
echo DYLD_LIBRARY_PATH is ${DYLD_LIBRARY_PATH};
shift 1
args=
while [ $# -gt 0 ]; do
token=$1
args="${args} \"${token}\""
shift
done
eval "\"${exe_dir}/tvp_GENERATOR.app/Contents/MacOS/tvp_GENERATOR\"" $args
fi
exit

BIN
002 After Image GUI Project/Program Compiled/for_redistribution_files_only/splash.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

34
002 After Image GUI Project/Program Compiled/for_redistribution_files_only/tvp_GENERATOR.app/Contents/Info.plist

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>prelaunch</string>
<key>CFBundleIconFile</key>
<string>membrane.icns</string>
<key>CFBundleIdentifier</key>
<string>tvp_GENERATOR</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>tvp_GENERATOR</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>tvp_GENERATOR</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CFBundleVersionString</key>
<string>1.0</string>
<key>CFResourcesFileMapped</key>
<true/>
<key>LSMinimumSystemVersion</key>
<string>10.9.0</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

BIN
002 After Image GUI Project/Program Compiled/for_redistribution_files_only/tvp_GENERATOR.app/Contents/MacOS/applauncher

Binary file not shown.

BIN
002 After Image GUI Project/Program Compiled/for_redistribution_files_only/tvp_GENERATOR.app/Contents/MacOS/prelaunch

Binary file not shown.

BIN
002 After Image GUI Project/Program Compiled/for_redistribution_files_only/tvp_GENERATOR.app/Contents/MacOS/tvp_GENERATOR

Binary file not shown.

BIN
002 After Image GUI Project/Program Compiled/for_redistribution_files_only/tvp_GENERATOR.app/Contents/Resources/Base.lproj/About.nib generated

Binary file not shown.

BIN
002 After Image GUI Project/Program Compiled/for_redistribution_files_only/tvp_GENERATOR.app/Contents/Resources/Base.lproj/MWOpenAccessoryView.nib generated

Binary file not shown.

BIN
002 After Image GUI Project/Program Compiled/for_redistribution_files_only/tvp_GENERATOR.app/Contents/Resources/Base.lproj/MWSaveAccessoryView.nib generated

Binary file not shown.

BIN
002 After Image GUI Project/Program Compiled/for_redistribution_files_only/tvp_GENERATOR.app/Contents/Resources/Base.lproj/MainMenu.nib generated

Binary file not shown.

BIN
002 After Image GUI Project/Program Compiled/for_redistribution_files_only/tvp_GENERATOR.app/Contents/Resources/membrane.icns

Binary file not shown.

BIN
002 After Image GUI Project/Program Compiled/for_testing/.DS_Store vendored

Binary file not shown.

7
002 After Image GUI Project/Program Compiled/for_testing/mccExcludedFiles.log

@ -0,0 +1,7 @@
The List of Excluded Files
Excluded files Exclusion Message ID Reason For Exclusion Exclusion Rule
/Applications/MATLAB_R2016a.app/toolbox/local/+matlab/+internal/+toolboxes/addInstalledToolboxesToPath.m MATLAB:Completion:ExcludedBy Cannot be packaged for use in the target environment MCR. Removed from the parts list by license Compiler. /Applications/MATLAB_R2016a\.app/toolbox/local/[+]matlab/[+]internal/[+]toolboxes/addInstalledToolboxesToPath[.]m
/Applications/MATLAB_R2016a.app/toolbox/local/+matlab/+internal/+zipAddOns/addInstalledZipAddOnsToPath.m MATLAB:Completion:ExcludedBy Cannot be packaged for use in the target environment MCR. Removed from the parts list by license Compiler. /Applications/MATLAB_R2016a\.app/toolbox/local/[+]matlab/[+]internal/[+]zipAddOns/addInstalledZipAddOnsToPath[.]m
/Applications/MATLAB_R2016a.app/toolbox/local/pathdef.m MATLAB:Completion:ExcludedBy Cannot be packaged for use in the target environment MCR. Removed from the parts list by license Compiler. /Applications/MATLAB_R2016a\.app/toolbox/local/pathdef[.]m
/Applications/MATLAB_R2016a.app/toolbox/matlab/codetools/commandwindow.m MATLAB:Completion:ExcludedBy Cannot be packaged for use in the target environment MCR. Removed from the parts list by license Compiler. /Applications/MATLAB_R2016a\.app/toolbox/matlab/codetools
/Applications/MATLAB_R2016a.app/toolbox/matlab/codetools/initdesktoputils.m MATLAB:Completion:ExcludedBy Cannot be packaged for use in the target environment MCR. Removed from the parts list by license Compiler. /Applications/MATLAB_R2016a\.app/toolbox/matlab/codetools

120
002 After Image GUI Project/Program Compiled/for_testing/readme.txt

@ -0,0 +1,120 @@
MATLAB Compiler
1. Prerequisites for Deployment
. Verify the MATLAB Runtime is installed and ensure you
have installed version 9.0.1 (R2016a).
. If the MATLAB Runtime is not installed, do the following:
(1) enter
>>mcrinstaller
at MATLAB prompt. The MCRINSTALLER command displays the
location of the MATLAB Runtime installer.
(2) run the MATLAB Runtime installer.
Or download the Macintosh version of the MATLAB Runtime for R2016a
from the MathWorks Web site by navigating to
http://www.mathworks.com/products/compiler/mcr/index.html
For more information about the MATLAB Runtime and the MATLAB Runtime installer, see
Package and Distribute in the MATLAB Compiler documentation
in the MathWorks Documentation Center.
NOTE: You will need administrator rights to run MCRInstaller.
2. Files to Deploy and Package
Files to package for Standalone
================================
-run_tvp_GENERATOR.sh (shell script for temporarily setting environment variables and
executing the application)
-to run the shell script, type
./run_tvp_GENERATOR.sh <mcr_directory> <argument_list>
at Linux or Mac command prompt. <mcr_directory> is the directory
where version 9.0.1 of the MATLAB Runtime is installed or the directory where
MATLAB is installed on the machine. <argument_list> is all the
arguments you want to pass to your application. For example,
If you have version 9.0.1 of the MATLAB Runtime installed in
/mathworks/home/application/v901, run the shell script as:
./run_tvp_GENERATOR.sh /mathworks/home/application/v901
If you have MATLAB installed in /mathworks/devel/application/matlab,
run the shell script as:
./run_tvp_GENERATOR.sh /mathworks/devel/application/matlab
-MCRInstaller.zip
-if end users are unable to download the MATLAB Runtime using the above
link, include it when building your component by clicking
the "Runtime downloaded from web" link in the Deployment Tool
-The Macintosh bundle directory structure tvp_GENERATOR.app
-this can be gathered up using the zip command
zip -r tvp_GENERATOR.zip tvp_GENERATOR.app
or the tar command
tar -cvf tvp_GENERATOR.tar tvp_GENERATOR.app
-This readme file
3. Definitions
For information on deployment terminology, go to
http://www.mathworks.com/help. Select MATLAB Compiler >
Getting Started > About Application Deployment >
Deployment Product Terms in the MathWorks Documentation
Center.
4. Appendix
A. Mac systems:
In the following directions, replace MCR_ROOT by the directory where the MATLAB Runtime
is installed on the target machine.
If the environment variable DYLD_LIBRARY_PATH is undefined, set it to the concatenation
of the following strings:
MCR_ROOT/v901/runtime/maci64:
MCR_ROOT/v901/sys/os/maci64:
MCR_ROOT/v901/bin/maci64
If it is defined, set it to the concatenation of these strings:
${LD_LIBRARY_PATH}:
MCR_ROOT/v901/runtime/maci64:
MCR_ROOT/v901/sys/os/maci64:
MCR_ROOT/v901/bin/maci64
For more detail information about setting the MATLAB Runtime paths, see Package and
Distribute in the MATLAB Compiler documentation in the MathWorks Documentation Center.
NOTE: To make these changes persistent after logout on Linux
or Mac machines, modify the .cshrc file to include this
setenv command.
NOTE: The environment variable syntax utilizes forward
slashes (/), delimited by colons (:).
NOTE: When deploying standalone applications, it is possible
to run the shell script file run_tvp_GENERATOR.sh
instead of setting environment variables. See
section 2 "Files to Deploy and Package".
5. Launching of application using Macintosh finder.
If the application is purely graphical, that is, it doesn't read from standard in or
write to standard out or standard error, it may be launched in the finder just like any
other Macintosh application.

1
002 After Image GUI Project/Program Compiled/for_testing/requiredMCRProducts.txt

@ -0,0 +1 @@
35000 35010

32
002 After Image GUI Project/Program Compiled/for_testing/run_tvp_GENERATOR.sh

@ -0,0 +1,32 @@
#!/bin/sh
# script for execution of deployed applications
#
# Sets up the MATLAB Runtime environment for the current $ARCH and executes
# the specified command.
#
exe_name=$0
exe_dir=`dirname "$0"`
echo "------------------------------------------"
if [ "x$1" = "x" ]; then
echo Usage:
echo $0 \<deployedMCRroot\> args
else
echo Setting up environment variables
MCRROOT="$1"
echo ---
DYLD_LIBRARY_PATH=.:${MCRROOT}/runtime/maci64 ;
DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:${MCRROOT}/bin/maci64 ;
DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:${MCRROOT}/sys/os/maci64;
export DYLD_LIBRARY_PATH;
echo DYLD_LIBRARY_PATH is ${DYLD_LIBRARY_PATH};
shift 1
args=
while [ $# -gt 0 ]; do
token=$1
args="${args} \"${token}\""
shift
done
eval "\"${exe_dir}/tvp_GENERATOR.app/Contents/MacOS/tvp_GENERATOR\"" $args
fi
exit

BIN
002 After Image GUI Project/Program Compiled/for_testing/splash.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

34
002 After Image GUI Project/Program Compiled/for_testing/tvp_GENERATOR.app/Contents/Info.plist

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>prelaunch</string>
<key>CFBundleIconFile</key>
<string>membrane.icns</string>
<key>CFBundleIdentifier</key>
<string>tvp_GENERATOR</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>tvp_GENERATOR</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>tvp_GENERATOR</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CFBundleVersionString</key>
<string>1.0</string>
<key>CFResourcesFileMapped</key>
<true/>
<key>LSMinimumSystemVersion</key>
<string>10.9.0</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

BIN
002 After Image GUI Project/Program Compiled/for_testing/tvp_GENERATOR.app/Contents/MacOS/applauncher

Binary file not shown.

BIN
002 After Image GUI Project/Program Compiled/for_testing/tvp_GENERATOR.app/Contents/MacOS/prelaunch

Binary file not shown.

BIN
002 After Image GUI Project/Program Compiled/for_testing/tvp_GENERATOR.app/Contents/MacOS/tvp_GENERATOR

Binary file not shown.

BIN
002 After Image GUI Project/Program Compiled/for_testing/tvp_GENERATOR.app/Contents/Resources/Base.lproj/About.nib generated

Binary file not shown.

BIN
002 After Image GUI Project/Program Compiled/for_testing/tvp_GENERATOR.app/Contents/Resources/Base.lproj/MWOpenAccessoryView.nib generated

Binary file not shown.

BIN
002 After Image GUI Project/Program Compiled/for_testing/tvp_GENERATOR.app/Contents/Resources/Base.lproj/MWSaveAccessoryView.nib generated

Binary file not shown.

BIN
002 After Image GUI Project/Program Compiled/for_testing/tvp_GENERATOR.app/Contents/Resources/Base.lproj/MainMenu.nib generated

Binary file not shown.

BIN
002 After Image GUI Project/Program Compiled/for_testing/tvp_GENERATOR.app/Contents/Resources/membrane.icns

Binary file not shown.

5
002 After Image GUI Project/Prueba_ReadTable.txt

@ -0,0 +1,5 @@
Luminance , Chro_littL , Chro_littS , l_axis s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 1.4 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 1.00 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 1.4 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0

120
002 After Image GUI Project/TRY_NonCardPULSE.m

@ -0,0 +1,120 @@
%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%
% I use this program to create a modified Zaidi paradigm in which there is
% one a NonCardinal pulse is added to a Cardinal zaidi stimulus at a given
% point and for a certain time.
clear all; %close all;
%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%
Calib_Dire = cd('/Users/clemente/Desktop/AfterImage Programs/002 After Image GUI Project');
load colorCalFile1.mat
pix = pix/1001;
%%%%%%%%%%%%%%%%%%
aa = cd('/Users/clemente/Desktop/AfterImage Programs/A Outputs');
commandwindow;
subName = upper(input('Subject Initials: ','s'));
hfpFile = sprintf('%sHFP', subName);
load(hfpFile, '-mat')
hfpRG = rg_avg;
hfpBG = bg_avg;
% a = '/Users/clemente/Dropbox/Luminotecnia/2018/Experiments/Color Background Afterimage/1 Programs/4 ColBackg AI' ;% folder where the program is.
cd(a);
%%%%%%%%%%%%%%%%%%
% TIMING
%find frames per second
ifi = 0.0118;% Measure the vertical refresh rate of the monitor
% topPriorityLevel = MaxPriority(window);% Retreive the maximum priority number
numSecs = 16; %in seconds, total presentation time
framesPerSec = round(1/ifi);
nFrames = numSecs * framesPerSec;
waitframes = 1; %number of frames to wait between refresh
%%%%%%%%%%%%%%%%%%
Chro = [.665 1]; iChro =1;
maxLum = 20;
cont = 1; iCont = 1;
lCont = .02;
sCont = .8;
%%%%%%%%%%%%%%%%%%
wLMS(1,1) = Chro(iChro,1)*maxLum;
wLMS(1,2) = (1-Chro(iChro,1))*maxLum;
wLMS(1,3) = Chro(iChro,2)*maxLum;
wXYZ(1,:) = LMS_to_XYZ(wLMS(1,:));
wRGB(1,:) = XYZ_to_RGB(wXYZ(1,:), maxPhosXYZ);
wRGB(1,1) = pix(dsearchn(redProp(:), wRGB(1,1)))*hfpRG;
wRGB(1,2) = pix(dsearchn(grnProp(:), wRGB(1,2)));
wRGB(1,3) = pix(dsearchn(blueProp(:), wRGB(1,3)))*hfpBG;
for i = 1:2
switch i
case 1
l = [Chro(iChro,1)+(Chro(iChro,1)*lCont(iChro,cont(iCont))) Chro(iChro,2) maxLum
Chro(iChro,1)-(Chro(iChro,1)*lCont(iChro,cont(iCont))) Chro(iChro,2) maxLum]; %+l, -l
colLut = l;
case 2
l_s_45 = [Chro(iChro,1)+(Chro(iChro,1)*lCont(iChro,cont(iCont))) Chro(iChro,2)+(Chro(iChro,2)*sCont(iChro,cont(iCont))) maxLum
Chro(iChro,1)-(Chro(iChro,1)*lCont(iChro,cont(iCont))) Chro(iChro,2)-(Chro(iChro,2)*sCont(iChro,cont(iCont))) maxLum];
colLut = l_s_45;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for iLMS = 1:2
cLMS(iLMS,1) = colLut(iLMS,1)*colLut(iLMS, 3);
cLMS(iLMS,2) = (1-colLut(iLMS,1))*colLut(iLMS, 3);
cLMS(iLMS,3) = colLut(iLMS,2)*colLut(iLMS, 3);
end
%XYZ values for each
for iXYZ = 1:length(cLMS(:,1))
cXYZ(iXYZ,:) = LMS_to_XYZ(cLMS(iXYZ,:));
end
%use lut to find corrected monitor RGB values for each rgb color
for iRGB = 1:length(cXYZ(:,1))
cRGB(iRGB,:) = XYZ_to_RGB(cXYZ(iRGB,:), maxPhosXYZ);
cRGB(iRGB,1) = pix(dsearchn(redProp(:), cRGB(iRGB,1)))*hfpRG;
cRGB(iRGB,2) = pix(dsearchn(grnProp(:), cRGB(iRGB,2)));
cRGB(iRGB,3) = pix(dsearchn(blueProp(:), cRGB(iRGB,3)))*hfpBG;
end
rampLeft = zeros(nFrames,3);
rampRight = zeros(nFrames,3);
for iRamp = 1:3 %for 3 phosophors
rampLeft(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(1,iRamp), nFrames);
rampRight(:,iRamp) = sinspace(wRGB(1,iRamp), cRGB(2,iRamp), nFrames);
end
switch i
case 1
left1 = rampLeft;
right1 = rampRight;
case 2
left2 = rampLeft;
right2 = rampRight;
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% COMBINE SIGNALS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
left1(637:722,1:3) = left2(637:722,1:3);
right1(637:722,1:3) = right2(637:722,1:3);
rampLeft = left1;
rampRight = right1;
save('rampLeft_Combined.mat','left1')
save('rampRight_Combined.mat','right1')

BIN
002 After Image GUI Project/TVP_GENERATOR.mlapp

Binary file not shown.

BIN
002 After Image GUI Project/TVP_GENERATOR.mlappinstall

Binary file not shown.

BIN
002 After Image GUI Project/TVP_GENERATOR_resources/.DS_Store vendored

Binary file not shown.

BIN
002 After Image GUI Project/TVP_GENERATOR_resources/icon_16.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

BIN
002 After Image GUI Project/TVP_GENERATOR_resources/icon_24.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

BIN
002 After Image GUI Project/TVP_GENERATOR_resources/icon_48.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 858 B

343
002 After Image GUI Project/Visu_Stim_Gen.prj

@ -0,0 +1,343 @@
<deployment-project plugin="plugin.ezdeploy" plugin-version="1.0">
<configuration build-checksum="1419338877" file="/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/001 After Image GUI Project/Visu_Stim_Gen.prj" location="/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/001 After Image GUI Project" name="Visu_Stim_Gen" preferred-package-location="/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/001 After Image GUI Project/Visu_Stim_Gen/for_redistribution" preferred-package-type="package.type.app" target="target.ezdeploy.standalone" target-name="Application Compiler">
<param.appname>Visu_Stim_Gen</param.appname>
<param.icon />
<param.icons />
<param.version>1.0</param.version>
<param.authnamewatermark>CPF</param.authnamewatermark>
<param.email />
<param.company />
<param.summary />
<param.description />
<param.screenshot />
<param.guid />
<param.installpath.string>/Visu_Stim_Gen/</param.installpath.string>
<param.installpath.combo>option.installpath.systemwideapp</param.installpath.combo>
<param.logo />
<param.install.notes>In the following directions, replace MCR_ROOT by the directory where the MATLAB Runtime is installed on the target machine.
If the environment variable DYLD_LIBRARY_PATH is undefined, set it to the concatenation of the following strings:
MCR_ROOT/v901/runtime/maci64:
MCR_ROOT/v901/sys/os/maci64:
MCR_ROOT/v901/bin/maci64
If it is defined, set it to the concatenation of these strings:
${LD_LIBRARY_PATH}:
MCR_ROOT/v901/runtime/maci64:
MCR_ROOT/v901/sys/os/maci64:
MCR_ROOT/v901/bin/maci64</param.install.notes>
<param.target.install.notes />
<param.intermediate>${PROJECT_ROOT}/Visu_Stim_Gen/for_testing</param.intermediate>
<param.files.only>${PROJECT_ROOT}/Visu_Stim_Gen/for_redistribution_files_only</param.files.only>
<param.output>${PROJECT_ROOT}/Visu_Stim_Gen/for_redistribution</param.output>
<param.logdir>${PROJECT_ROOT}/Visu_Stim_Gen</param.logdir>
<param.enable.clean.build>false</param.enable.clean.build>
<param.user.defined.mcr.options />
<param.embed.ctf>true</param.embed.ctf>
<param.target.type>subtarget.standalone</param.target.type>
<param.support.packages />
<param.web.mcr>true</param.web.mcr>
<param.package.mcr>false</param.package.mcr>
<param.no.mcr>false</param.no.mcr>
<param.web.mcr.name>MyAppInstaller_web</param.web.mcr.name>
<param.package.mcr.name>MyAppInstaller_mcr</param.package.mcr.name>
<param.no.mcr.name>MyAppInstaller_app</param.no.mcr.name>
<param.windows.command.prompt>false</param.windows.command.prompt>
<param.create.log>false</param.create.log>
<param.log.file />
<unset>
<param.icon />
<param.icons />
<param.version />
<param.email />
<param.company />
<param.summary />
<param.description />
<param.screenshot />
<param.guid />
<param.installpath.string />
<param.installpath.combo />
<param.logo />
<param.target.install.notes />
<param.intermediate />
<param.files.only />
<param.output />
<param.logdir />
<param.enable.clean.build />
<param.user.defined.mcr.options />
<param.embed.ctf />
<param.target.type />
<param.support.packages />
<param.web.mcr />
<param.package.mcr />
<param.no.mcr />
<param.web.mcr.name />
<param.package.mcr.name />
<param.no.mcr.name />
<param.windows.command.prompt />
<param.create.log />
<param.log.file />
</unset>
<fileset.main>
<file>${PROJECT_ROOT}/AppTEST.mlapp</file>
</fileset.main>
<fileset.resources />
<fileset.package />
<fileset.depfun>
<file>/Applications/Psychtoolbox/PsychBasic/CharAvail.m</file>
<file>/Applications/Psychtoolbox/PsychBasic/Datapixx.mexmaci64</file>
<file>/Applications/Psychtoolbox/PsychBasic/DrawFormattedText.m</file>
<file>/Applications/Psychtoolbox/PsychBasic/FlushEvents.m</file>
<file>/Applications/Psychtoolbox/PsychBasic/GetChar.m</file>
<file>/Applications/Psychtoolbox/PsychBasic/GetSecs.m</file>
<file>/Applications/Psychtoolbox/PsychBasic/GetSecs.mexmaci64</file>
<file>/Applications/Psychtoolbox/PsychBasic/HideCursor.m</file>
<file>/Applications/Psychtoolbox/PsychBasic/IOPort.m</file>
<file>/Applications/Psychtoolbox/PsychBasic/IOPort.mexmaci64</file>
<file>/Applications/Psychtoolbox/PsychBasic/IsWinVista.m</file>
<file>/Applications/Psychtoolbox/PsychBasic/KbCheck.m</file>
<file>/Applications/Psychtoolbox/PsychBasic/KbName.m</file>
<file>/Applications/Psychtoolbox/PsychBasic/KbQueueReserve.m</file>
<file>/Applications/Psychtoolbox/PsychBasic/LoadPsychHID.m</file>
<file>/Applications/Psychtoolbox/PsychBasic/MachAbsoluteTimeClockFrequency.m</file>
<file>/Applications/Psychtoolbox/PsychBasic/MachAbsoluteTimeClockFrequency.mexmaci64</file>
<file>/Applications/Psychtoolbox/PsychBasic/MachGetPriorityMex.mexmaci64</file>
<file>/Applications/Psychtoolbox/PsychBasic/MachSetPriorityMex.mexmaci64</file>
<file>/Applications/Psychtoolbox/PsychBasic/PsychHID.mexmaci64</file>
<file>/Applications/Psychtoolbox/PsychBasic/Screen.m</file>
<file>/Applications/Psychtoolbox/PsychBasic/Screen.mexmaci64</file>
<file>/Applications/Psychtoolbox/PsychBasic/SetMouse.m</file>
<file>/Applications/Psychtoolbox/PsychBasic/ShowCursor.m</file>
<file>/Applications/Psychtoolbox/PsychBasic/WaitSecs.m</file>
<file>/Applications/Psychtoolbox/PsychBasic/WaitSecs.mexmaci64</file>
<file>/Applications/Psychtoolbox/PsychBasic/moglcore.mexmaci64</file>
<file>/Applications/Psychtoolbox/PsychBasic/psychlasterror.m</file>
<file>/Applications/Psychtoolbox/PsychBasic/psychrethrow.m</file>
<file>/Applications/Psychtoolbox/PsychContributed/ple.m</file>
<file>/Applications/Psychtoolbox/PsychFiles/PsychtoolboxConfigDir.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/AddImageUndistortionToGLOperator.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/AddToGLOperator.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/BitsPlusPlus.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/CountSlotsInGLOperator.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/CreateDisplayWarp.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/CreateGLOperator.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/CreatePseudoGrayLUT.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/PsychColorCorrection.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/PsychHelperCreateARGB2101010RemapCLUT.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/PsychHelperCreateGenericLuminanceToRGBA8LUT.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/PsychHelperCreateRGB111110RemapCLUT.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/PsychHelperCreateRemapCLUT.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/PsychImaging.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/PsychVideoSwitcher.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/SetCompressedStereoSideBySideParameters.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/kPsychNeed16BPCFixed.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/kPsychNeed16BPCFloat.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/kPsychNeed32BPCFloat.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/kPsychNeedDualPass.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/kPsychNeedDualWindowOutput.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/kPsychNeedFastBackingStore.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/kPsychNeedFastOffscreenWindows.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/kPsychNeedHalfHeightWindow.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/kPsychNeedHalfWidthWindow.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/kPsychNeedImageProcessing.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/kPsychNeedMultiPass.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/kPsychNeedOtherStreamInput.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/kPsychNeedOutputConversion.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/kPsychNeedRetinaResolution.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/kPsychNeedTwiceWidthWindow.m</file>
<file>/Applications/Psychtoolbox/PsychGLImageProcessing/kPsychUse32BPCFloatAsap.m</file>
<file>/Applications/Psychtoolbox/PsychHardware/BitsPlusToolbox/BitsPlusDIO2Matrix.m</file>
<file>/Applications/Psychtoolbox/PsychHardware/BitsPlusToolbox/bitsEncodeDIO.m</file>
<file>/Applications/Psychtoolbox/PsychHardware/BitsPlusToolbox/bitsGoggles.m</file>
<file>/Applications/Psychtoolbox/PsychHardware/BrightSideDisplay/BrightSideCore.m</file>
<file>/Applications/Psychtoolbox/PsychHardware/BrightSideDisplay/BrightSideHDR.m</file>
<file>/Applications/Psychtoolbox/PsychHardware/DatapixxToolbox/DatapixxBasic/PsychDataPixx.m</file>
<file>/Applications/Psychtoolbox/PsychHardware/FindSerialPort.m</file>
<file>/Applications/Psychtoolbox/PsychHardware/GetKeyboardIndices.m</file>
<file>/Applications/Psychtoolbox/PsychHardware/GetKeypadIndices.m</file>
<file>/Applications/Psychtoolbox/PsychHardware/PsychGPURasterizerOffsets.m</file>
<file>/Applications/Psychtoolbox/PsychHardware/PsychGPUTestAndTweakGammaTables.m</file>
<file>/Applications/Psychtoolbox/PsychHardware/SerialComm.m</file>
<file>/Applications/Psychtoolbox/PsychJava/AssignGetCharJava.m</file>
<file>/Applications/Psychtoolbox/PsychJava/JavaTimeToGetSecs.m</file>
<file>/Applications/Psychtoolbox/PsychJava/PsychJavaSwingCleanup.m</file>
<file>/Applications/Psychtoolbox/PsychJava/PsychJavaTrouble.m</file>
<file>/Applications/Psychtoolbox/PsychJava/psychusejava.m</file>
<file>/Applications/Psychtoolbox/PsychObsolete/IsOS9.m</file>
<file>/Applications/Psychtoolbox/PsychObsolete/IsWindows.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/AssertGLSL.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/AssertMex.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/AssertOSX.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/AssertOpenGL.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/Is64Bit.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/IsGLES.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/IsGUI.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/IsLinux.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/IsOSX.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/IsOctave.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/IsWayland.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/IsWin.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/LoadIdentityClut.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/OSName.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/PsychDefaultSetup.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/PsychGPUControl.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/PsychNumel.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/PsychtoolboxRoot.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/RestoreCluts.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/SaveIdentityClut.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/Speak.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/WhiteIndex.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/WrapString.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/sca.m</file>
<file>/Applications/Psychtoolbox/PsychOneliners/streq.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/LoadGLSLProgramFromFiles.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/LoadShaderFromFile.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/core/InitializeMatlabOpenGL.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/core/mor.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glActiveTexture.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glAttachShader.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glBegin.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glBindTexture.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glCallList.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glColor3ub.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glColor4f.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glColorMask.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glCompileShader.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glCreateProgram.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glCreateShader.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glDisable.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glDisableClientState.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glDrawArrays.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glDrawPixels.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glEnable.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glEnableClientState.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glEnd.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glEndList.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glEvalMesh2.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glGenLists.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glGenTextures.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glGetError.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glGetIntegerv.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glGetString.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glGetUniformLocation.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glIsList.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glLinkProgram.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glLoadIdentity.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glMap2d.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glMapGrid2d.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glMatrixMode.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glMultMatrixf.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glNewList.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glOrthof.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glPointSize.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glPopAttrib.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glPopMatrix.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glPushAttrib.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glPushMatrix.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glRasterPos2f.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glRasterPos2i.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glRotatef.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glShaderSource.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glTexCoord2f.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glTexCoordPointer.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glTexImage2D.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glTexImage3D.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glTexParameteri.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glTexSubImage2D.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glTranslatef.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glUniform1f.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glUniform1i.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glUniform2f.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glUniform3f.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glUniform3fv.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glUniformMatrix3fv.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glUniformMatrix4fv.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glUseProgram.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glVertex2f.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glVertex2i.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/glVertexPointer.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/gluErrorString.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/gluOrtho2D.m</file>
<file>/Applications/Psychtoolbox/PsychOpenGL/MOGL/wrap/moglsingle.m</file>
<file>/Applications/Psychtoolbox/PsychPriority/MachGetPriorityFlavor.m</file>
<file>/Applications/Psychtoolbox/PsychPriority/MachSetStandardPriority.m</file>
<file>/Applications/Psychtoolbox/PsychPriority/MachSetTimeConstraintPriority.m</file>
<file>/Applications/Psychtoolbox/PsychPriority/MaxPriority.m</file>
<file>/Applications/Psychtoolbox/PsychPriority/Priority.m</file>
<file>/Applications/Psychtoolbox/PsychRects/CenterRect.m</file>
<file>/Applications/Psychtoolbox/PsychRects/CenterRectOnPointd.m</file>
<file>/Applications/Psychtoolbox/PsychRects/ClipRect.m</file>
<file>/Applications/Psychtoolbox/PsychRects/OffsetRect.m</file>
<file>/Applications/Psychtoolbox/PsychRects/RectBottom.m</file>
<file>/Applications/Psychtoolbox/PsychRects/RectCenter.m</file>
<file>/Applications/Psychtoolbox/PsychRects/RectCenterd.m</file>
<file>/Applications/Psychtoolbox/PsychRects/RectHeight.m</file>
<file>/Applications/Psychtoolbox/PsychRects/RectLeft.m</file>
<file>/Applications/Psychtoolbox/PsychRects/RectRight.m</file>
<file>/Applications/Psychtoolbox/PsychRects/RectTop.m</file>
<file>/Applications/Psychtoolbox/PsychRects/RectWidth.m</file>
<file>/Applications/Psychtoolbox/PsychRects/ScaleRect.m</file>
<file>/Applications/Psychtoolbox/PsychRects/SetRect.m</file>
<file>${PROJECT_ROOT}/AfIm_Exp.m</file>
<file>${PROJECT_ROOT}/ContMatch_session.m</file>
<file>${PROJECT_ROOT}/Disp_Color.m</file>
<file>${PROJECT_ROOT}/HFP_session.m</file>
<file>${PROJECT_ROOT}/LMS_to_XYZ.m</file>
<file>${PROJECT_ROOT}/XYZ_to_RGB.m</file>
<file>${PROJECT_ROOT}/sinspaceOneCycle.m</file>
</fileset.depfun>
<build-deliverables>
<file location="${PROJECT_ROOT}/Visu_Stim_Gen/for_testing" name="readme.txt" optional="true">/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/001 After Image GUI Project/Visu_Stim_Gen/for_testing/readme.txt</file>
<file location="${PROJECT_ROOT}/Visu_Stim_Gen/for_testing" name="splash.png" optional="false">/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/001 After Image GUI Project/Visu_Stim_Gen/for_testing/splash.png</file>
<file location="${PROJECT_ROOT}/Visu_Stim_Gen/for_testing" name="Visu_Stim_Gen.app" optional="false">/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/001 After Image GUI Project/Visu_Stim_Gen/for_testing/Visu_Stim_Gen.app</file>
<file location="${PROJECT_ROOT}/Visu_Stim_Gen/for_testing" name="run_Visu_Stim_Gen.sh" optional="false">/Users/clemente/Dropbox/Luminotecnia/2017/Chicago Lab files/2 Experiments/Color AfterImage_Exp_Room_150/2nd/1 Programs/001 After Image GUI Project/Visu_Stim_Gen/for_testing/run_Visu_Stim_Gen.sh</file>
</build-deliverables>
<workflow />
<matlab>
<root>/Applications/MATLAB_R2016a.app</root>
<toolboxes>
<toolbox name="fixedpoint" />
<toolbox name="matlabcoder" />
<toolbox name="matlabhdlcoder" />
<toolbox name="embeddedcoder" />
</toolboxes>
<toolbox>
<fixedpoint>
<enabled>true</enabled>
</fixedpoint>
</toolbox>
<toolbox>
<matlabcoder>
<enabled>true</enabled>
</matlabcoder>
</toolbox>
<toolbox>
<matlabhdlcoder>
<enabled>true</enabled>
</matlabhdlcoder>
</toolbox>
<toolbox>
<embeddedcoder>
<enabled>true</enabled>
</embeddedcoder>
</toolbox>
</matlab>
<platform>
<unix>true</unix>
<mac>true</mac>
<windows>false</windows>
<win2k>false</win2k>
<winxp>false</winxp>
<vista>false</vista>
<linux>false</linux>
<solaris>false</solaris>
<osver>10.11.6</osver>
<os32>false</os32>
<os64>true</os64>
<arch>maci64</arch>
<matlab>true</matlab>
</platform>
</configuration>
</deployment-project>

0
002 After Image GUI Project/XX_SessionsInfo

73
002 After Image GUI Project/XYZ_to_RGB.m

@ -0,0 +1,73 @@
function RGB = XYZ_to_RGB(XYZ, Primary)
% function RGB = Color_Convert_XYZ_to_RGB(XYZ, Primary)
%
% Converts from Judd-Vos XYZ to Monitor RGB (for monitor with Primaries defined in Judd-Vos XYZ)
%
% Takes: XYZ (N, 3) - XYZ coordinates
% Primary (3, 3) - XYZ coordinates of red, green and blue guns / filters of monitor
% Returns: RGB (N, 3) - RGB coordinates (scaled from 0 to 1)
% Dependencies: Variable_Report.m
%
% Created 2015-06-26 by KCM
%
% Updated 2015-07-10 by KCM
%% Arguments
if ~exist('XYZ', 'var') || isempty(XYZ)
fprintf(char(strcat({'\nColor_Convert_XYZ_to_RGB: '}, {'''XYZ'' must be provided!\n\n'})))
RGB = []; return
end
if ~ismatrix(XYZ) || size(XYZ, 2) ~= 3
fprintf(char(strcat({'\nColor_Convert_XYZ_to_RGB: '}, {'''XYZ'' must have size (N, 3)!\n\n'})))
RGB = []; return
end
if sum(sum(~isfinite(XYZ))) || sum(sum(~isreal(XYZ)))
fprintf(char(strcat({'\nColor_Convert_XYZ_to_RGB: '}, ...
{'''XYZ'' must be finite and real!\n\n'})))
RGB = []; return
end
if ~exist('Primary', 'var') || isempty(Primary)
fprintf(char(strcat({'\nColor_Convert_XYZ_to_RGB: '}, {'''Primary'' must be provided!\n\n'})))
RGB = []; return
end
if ~ismatrix(Primary) || size(Primary, 1) ~= 3 || size(Primary, 2) ~= 3
fprintf(char(strcat({'\nColor_Convert_XYZ_to_RGB: '}, ...
{'''Primary'' must have size (3, 3)!\n\n'})))
RGB = []; return
end
if sum(sum(~isfinite(Primary))) || sum(sum(~isreal(Primary)))
fprintf(char(strcat({'\nColor_Convert_XYZ_to_RGB: '}, ...
{'''Primary'' must be finite and real!\n\n'})))
RGB = []; return
end
%% Denominator
denom = Primary(1, 1) * Primary(2, 2) * Primary(3, 3) + ...
Primary(2, 1) * Primary(3, 2) * Primary(1, 3) + ...
Primary(3, 1) * Primary(1, 2) * Primary(2, 3) - ...
Primary(1, 1) * Primary(3, 2) * Primary(2, 3) - ...
Primary(2, 1) * Primary(1, 2) * Primary(3, 3) - ...
Primary(3, 1) * Primary(2, 2) * Primary(1, 3);
%% Components
rX = (Primary(2, 2) * Primary(3, 3) - Primary(2, 3) * Primary(3, 2)) / denom;
rY = (Primary(2, 3) * Primary(3, 1) - Primary(2, 1) * Primary(3, 3)) / denom;
rZ = (Primary(2, 1) * Primary(3, 2) - Primary(2, 2) * Primary(3, 1)) / denom;
gX = (Primary(3, 2) * Primary(1, 3) - Primary(3, 3) * Primary(1, 2)) / denom;
gY = (Primary(3, 3) * Primary(1, 1) - Primary(3, 1) * Primary(1, 3)) / denom;
gZ = (Primary(3, 1) * Primary(1, 2) - Primary(3, 2) * Primary(1, 1)) / denom;
bX = (Primary(1, 2) * Primary(2, 3) - Primary(1, 3) * Primary(2, 2)) / denom;
bY = (Primary(1, 3) * Primary(2, 1) - Primary(1, 1) * Primary(2, 3)) / denom;
bZ = (Primary(1, 1) * Primary(2, 2) - Primary(1, 2) * Primary(2, 1)) / denom; clear Primary denom
%% RGB Values
tR = rX .* XYZ(:, 1) + rY .* XYZ(:, 2) + rZ .* XYZ(:, 3); clear rX rY rZ
tG = gX .* XYZ(:, 1) + gY .* XYZ(:, 2) + gZ .* XYZ(:, 3); clear gX gY gZ
tB = bX .* XYZ(:, 1) + bY .* XYZ(:, 2) + bZ .* XYZ(:, 3); clear XYZ bX bY bZ
RGB = [tR, tG, tB]; clear tR tG tB
RGB = round(RGB .* 1000) ./ 1000;
% %% Variable Report (Housecleaning: for spotting uncleared variables. Omit if desired)
% Variable_Report(whos, 'RGB')
end

BIN
002 After Image GUI Project/colorCalFile1.mat

Binary file not shown.

13
002 After Image GUI Project/flatSound.m

@ -0,0 +1,13 @@
function flatSound
% written by CPF
Nsecs = 1; %number of seconds
delta_t = 1/4096;
t = 0:delta_t:(Nsecs-delta_t);
Fs=4096; % sampling frequency
freq = 400 ; % frequency of the sound
A = 0.6;% amplitud of the sound (between 1 and -1 so it can be played by 'sound' function of Matlab
y = A*sin(2*pi*freq*t); % build the intensities over time
sound(y,Fs)
end

15
002 After Image GUI Project/pruebaFuncion.m

@ -0,0 +1,15 @@
if gt(Bckg_Chro,1)
% f = figure('Position', [100 100 752 250]);
t = uitable('Parent', Table1, 'Position', [25 50 700 200], 'Data', Bckg_Chro)
else
% f = figure('Position', [100 100 752 250]);
t = uitable('Parent', , 'Position', [25 50 700 200], 'Data', Bckg_Chro)

37
002 After Image GUI Project/pruebaReadTable.m

@ -0,0 +1,37 @@
[FileName,PathName] = uigetfile('*.txt','Select the MATLAB code file');
if FileName == 0%
return
else
ExpCond = readtable(FileName,'Delimiter',',')
Bckg_Chro = [ExpCond{:,2} ExpCond{:,3}];
app.Lum_Field.Value = str2num(Values{1});
app.littleL_Field.Value = str2num(Values{2});
app.littleS_Field.Value = str2num(Values{3});
app.CheckBox.Value = str2num(Values{1,4});
app.CheckBox2.Value = str2num(Values{1,5});
app.CheckBox3.Value = str2num(Values{1,6});
app.CheckBox4.Value = str2num(Values{1,7});
app.CheckBox5.Value = str2num(Values{1,8});
app.CheckBox6.Value = str2num(Values{1,9});
app.CheckBox7.Value = str2num(Values{1,10});
app.CheckBox8.Value = str2num(Values{1,11});
app.CheckBox9.Value = str2num(Values{1,12});
end
app.Lum_Field.Value = ExpCond{1,1};
app.littleL_Field.Value = ExpCond{1,2};
app.littleS_Field.Value = ExpCond{1,3};
app.CheckBox.Value = ExpCond{1,4};
app.CheckBox2.Value = ExpCond{1,5};
app.CheckBox3.Value = ExpCond{1,6};
app.CheckBox4.Value = ExpCond{1,7};
app.CheckBox5.Value = ExpCond{1,8};
app.CheckBox6.Value = ExpCond{1,9};
app.CheckBox7.Value = ExpCond{1,10};
app.CheckBox8.Value = ExpCond{1,11};
app.CheckBox9.Value = ExpCond{1,12};

9
002 After Image GUI Project/sinspace.m

@ -0,0 +1,9 @@
function [c] = sinspace(a, b, n)
c = zeros(1, n);
ind = [0:pi/n:pi];
for i=1:n
c(i) = a + (b-a)*sin(ind(i));
end
return;

9
002 After Image GUI Project/sinspaceOneCycle.m

@ -0,0 +1,9 @@
function [c] = OneCycleSinspace(a, b, n)
c = zeros(1, n);
ind = [0:2*pi/n:2*pi];
for i=1:n
c(i) = a + (b-a)*sin(ind(i));
end
return;

268
002 After Image GUI Project/tvp_GENERATOR.prj

@ -0,0 +1,268 @@
<deployment-project plugin="plugin.apptool" plugin-version="1.0">
<configuration build-checksum="3991502601" file="D:\Dropbox\Luminotecnia\2018\Experiments\Color Background Afterimage\1 Programs\002 After Image GUI Project\tvp_GENERATOR.prj" location="D:\Dropbox\Luminotecnia\2018\Experiments\Color Background Afterimage\1 Programs\002 After Image GUI Project" name="tvp_GENERATOR" target="target.mlapps" target-name="Package App">
<param.appname>tvp_GENERATOR</param.appname>
<param.authnamewatermark>CPF</param.authnamewatermark>
<param.email />
<param.company>UIC</param.company>
<param.icon>${PROJECT_ROOT}\tvp_GENERATOR_resources\icon_24.png</param.icon>
<param.icons>
<file>${PROJECT_ROOT}\TVP_GENERATOR_resources\icon_48.png</file>
<file>${PROJECT_ROOT}\TVP_GENERATOR_resources\icon_24.png</file>
<file>${PROJECT_ROOT}\TVP_GENERATOR_resources\icon_16.png</file>
</param.icons>
<param.summary />
<param.description />
<param.screenshot />
<param.version>1.0</param.version>
<param.products.name />
<param.products.id />
<param.products.version />
<param.platforms>
<item>maci64</item>
</param.platforms>
<param.output>${PROJECT_ROOT}\App Name.mlappinstall</param.output>
<param.guid>05b15400-8656-4ef0-8422-d77d5791bf20</param.guid>
<unset>
<param.email />
<param.summary />
<param.description />
<param.screenshot />
<param.version />
<param.products.name />
<param.products.id />
<param.products.version />
<param.output />
</unset>
<fileset.main>
<file>${PROJECT_ROOT}\TVP_GENERATOR.mlapp</file>
</fileset.main>
<fileset.depfun>
<file>C:\Applications\Psychtoolbox\PsychBasic\CharAvail.m</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\Datapixx.mexmaci64</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\DrawFormattedText.m</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\FlushEvents.m</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\GetChar.m</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\GetSecs.m</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\GetSecs.mexmaci64</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\HideCursor.m</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\IOPort.m</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\IOPort.mexmaci64</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\IsWinVista.m</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\KbCheck.m</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\KbName.m</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\KbQueueReserve.m</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\LoadPsychHID.m</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\MachAbsoluteTimeClockFrequency.m</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\MachAbsoluteTimeClockFrequency.mexmaci64</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\MachGetPriorityMex.mexmaci64</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\MachSetPriorityMex.mexmaci64</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\moglcore.mexmaci64</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\PsychHID.mexmaci64</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\psychlasterror.m</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\psychrethrow.m</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\Screen.m</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\Screen.mexmaci64</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\SetMouse.m</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\ShowCursor.m</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\WaitSecs.m</file>
<file>C:\Applications\Psychtoolbox\PsychBasic\WaitSecs.mexmaci64</file>
<file>C:\Applications\Psychtoolbox\PsychContributed\ple.m</file>
<file>C:\Applications\Psychtoolbox\PsychFiles\PsychtoolboxConfigDir.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\AddImageUndistortionToGLOperator.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\AddToGLOperator.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\BitsPlusPlus.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\CountSlotsInGLOperator.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\CreateDisplayWarp.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\CreateGLOperator.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\CreatePseudoGrayLUT.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\kPsychNeed16BPCFixed.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\kPsychNeed16BPCFloat.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\kPsychNeed32BPCFloat.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\kPsychNeedDualPass.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\kPsychNeedDualWindowOutput.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\kPsychNeedFastBackingStore.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\kPsychNeedFastOffscreenWindows.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\kPsychNeedHalfHeightWindow.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\kPsychNeedHalfWidthWindow.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\kPsychNeedImageProcessing.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\kPsychNeedMultiPass.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\kPsychNeedOtherStreamInput.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\kPsychNeedOutputConversion.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\kPsychNeedRetinaResolution.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\kPsychNeedTwiceWidthWindow.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\kPsychUse32BPCFloatAsap.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\PsychColorCorrection.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\PsychHelperCreateARGB2101010RemapCLUT.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\PsychHelperCreateGenericLuminanceToRGBA8LUT.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\PsychHelperCreateRemapCLUT.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\PsychHelperCreateRGB111110RemapCLUT.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\PsychImaging.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\PsychVideoSwitcher.m</file>
<file>C:\Applications\Psychtoolbox\PsychGLImageProcessing\SetCompressedStereoSideBySideParameters.m</file>
<file>C:\Applications\Psychtoolbox\PsychHardware\BitsPlusToolbox\bitsEncodeDIO.m</file>
<file>C:\Applications\Psychtoolbox\PsychHardware\BitsPlusToolbox\bitsGoggles.m</file>
<file>C:\Applications\Psychtoolbox\PsychHardware\BitsPlusToolbox\BitsPlusDIO2Matrix.m</file>
<file>C:\Applications\Psychtoolbox\PsychHardware\BrightSideDisplay\BrightSideCore.m</file>
<file>C:\Applications\Psychtoolbox\PsychHardware\BrightSideDisplay\BrightSideHDR.m</file>
<file>C:\Applications\Psychtoolbox\PsychHardware\DatapixxToolbox\DatapixxBasic\PsychDataPixx.m</file>
<file>C:\Applications\Psychtoolbox\PsychHardware\FindSerialPort.m</file>
<file>C:\Applications\Psychtoolbox\PsychHardware\GetKeyboardIndices.m</file>
<file>C:\Applications\Psychtoolbox\PsychHardware\GetKeypadIndices.m</file>
<file>C:\Applications\Psychtoolbox\PsychHardware\PsychGPURasterizerOffsets.m</file>
<file>C:\Applications\Psychtoolbox\PsychHardware\PsychGPUTestAndTweakGammaTables.m</file>
<file>C:\Applications\Psychtoolbox\PsychHardware\SerialComm.m</file>
<file>C:\Applications\Psychtoolbox\PsychJava\AssignGetCharJava.m</file>
<file>C:\Applications\Psychtoolbox\PsychJava\JavaTimeToGetSecs.m</file>
<file>C:\Applications\Psychtoolbox\PsychJava\PsychJavaSwingCleanup.m</file>
<file>C:\Applications\Psychtoolbox\PsychJava\PsychJavaTrouble.m</file>
<file>C:\Applications\Psychtoolbox\PsychJava\psychusejava.m</file>
<file>C:\Applications\Psychtoolbox\PsychObsolete\IsOS9.m</file>
<file>C:\Applications\Psychtoolbox\PsychObsolete\IsWindows.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\AssertGLSL.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\AssertMex.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\AssertOpenGL.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\AssertOSX.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\Is64Bit.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\IsGLES.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\IsGUI.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\IsLinux.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\IsOctave.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\IsOSX.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\IsWayland.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\IsWin.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\LoadIdentityClut.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\OSName.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\PsychDefaultSetup.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\PsychGPUControl.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\PsychNumel.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\PsychtoolboxRoot.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\RestoreCluts.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\SaveIdentityClut.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\sca.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\Speak.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\streq.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\WhiteIndex.m</file>
<file>C:\Applications\Psychtoolbox\PsychOneliners\WrapString.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\LoadGLSLProgramFromFiles.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\LoadShaderFromFile.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\core\InitializeMatlabOpenGL.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\core\mor.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glActiveTexture.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glAttachShader.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glBegin.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glBindTexture.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glCallList.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glColor3ub.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glColor4f.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glColorMask.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glCompileShader.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glCreateProgram.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glCreateShader.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glDisable.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glDisableClientState.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glDrawArrays.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glDrawPixels.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glEnable.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glEnableClientState.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glEnd.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glEndList.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glEvalMesh2.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glGenLists.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glGenTextures.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glGetError.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glGetIntegerv.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glGetString.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glGetUniformLocation.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glIsList.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glLinkProgram.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glLoadIdentity.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glMap2d.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glMapGrid2d.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glMatrixMode.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glMultMatrixf.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glNewList.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glOrthof.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glPointSize.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glPopAttrib.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glPopMatrix.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glPushAttrib.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glPushMatrix.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glRasterPos2f.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glRasterPos2i.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glRotatef.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glShaderSource.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glTexCoord2f.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glTexCoordPointer.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glTexImage2D.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glTexImage3D.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glTexParameteri.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glTexSubImage2D.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glTranslatef.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\gluErrorString.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glUniform1f.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glUniform1i.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glUniform2f.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glUniform3f.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glUniform3fv.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glUniformMatrix3fv.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glUniformMatrix4fv.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\gluOrtho2D.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glUseProgram.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glVertex2f.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glVertex2i.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\glVertexPointer.m</file>
<file>C:\Applications\Psychtoolbox\PsychOpenGL\MOGL\wrap\moglsingle.m</file>
<file>C:\Applications\Psychtoolbox\PsychPriority\MachGetPriorityFlavor.m</file>
<file>C:\Applications\Psychtoolbox\PsychPriority\MachSetStandardPriority.m</file>
<file>C:\Applications\Psychtoolbox\PsychPriority\MachSetTimeConstraintPriority.m</file>
<file>C:\Applications\Psychtoolbox\PsychPriority\MaxPriority.m</file>
<file>C:\Applications\Psychtoolbox\PsychPriority\Priority.m</file>
<file>C:\Applications\Psychtoolbox\PsychRects\CenterRect.m</file>
<file>C:\Applications\Psychtoolbox\PsychRects\CenterRectOnPointd.m</file>
<file>C:\Applications\Psychtoolbox\PsychRects\ClipRect.m</file>
<file>C:\Applications\Psychtoolbox\PsychRects\OffsetRect.m</file>
<file>C:\Applications\Psychtoolbox\PsychRects\RectBottom.m</file>
<file>C:\Applications\Psychtoolbox\PsychRects\RectCenter.m</file>
<file>C:\Applications\Psychtoolbox\PsychRects\RectCenterd.m</file>
<file>C:\Applications\Psychtoolbox\PsychRects\RectHeight.m</file>
<file>C:\Applications\Psychtoolbox\PsychRects\RectLeft.m</file>
<file>C:\Applications\Psychtoolbox\PsychRects\RectRight.m</file>
<file>C:\Applications\Psychtoolbox\PsychRects\RectTop.m</file>
<file>C:\Applications\Psychtoolbox\PsychRects\RectWidth.m</file>
<file>C:\Applications\Psychtoolbox\PsychRects\ScaleRect.m</file>
<file>C:\Applications\Psychtoolbox\PsychRects\SetRect.m</file>
<file>${PROJECT_ROOT}\AfIm_Exp.m</file>
<file>${PROJECT_ROOT}\ContMatch_session.m</file>
<file>${PROJECT_ROOT}\Disp_Color.m</file>
<file>${PROJECT_ROOT}\HFP_session.m</file>
<file>${PROJECT_ROOT}\LMS_to_XYZ.m</file>
<file>${PROJECT_ROOT}\sinspaceOneCycle.m</file>
<file>${PROJECT_ROOT}\XYZ_to_RGB.m</file>
</fileset.depfun>
<fileset.resources />
<fileset.package />
<build-deliverables>
<file location="D:\Dropbox\Luminotecnia\2018\Experiments\Color Background Afterimage\1 Programs\002 After Image GUI Project" name="App Name.mlappinstall" optional="false">D:\Dropbox\Luminotecnia\2018\Experiments\Color Background Afterimage\1 Programs\002 After Image GUI Project\App Name.mlappinstall</file>
</build-deliverables>
<workflow />
<matlab>
<root>D:\Archivos de Programa\Matlab 2014</root>
<toolboxes />
</matlab>
<platform>
<unix>false</unix>
<mac>false</mac>
<windows>true</windows>
<win2k>false</win2k>
<winxp>false</winxp>
<vista>false</vista>
<linux>false</linux>
<solaris>false</solaris>
<osver>6.2</osver>
<os32>false</os32>
<os64>true</os64>
<arch>win64</arch>
<matlab>true</matlab>
</platform>
</configuration>
</deployment-project>

BIN
Experimental Conditions (zaidi paradigm)/.DS_Store vendored

Binary file not shown.

2
Experimental Conditions (zaidi paradigm)/01 Backgr_EEW_9axes_4cont.txt

@ -0,0 +1,2 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis, s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.00 , 60, 3 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1

14
Experimental Conditions (zaidi paradigm)/MT_9_CHROS_lum.txt

@ -0,0 +1,14 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis, s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.000 , 60, 5 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 2.000 , 60, 5 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 3.000 , 60, 5 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 0.647 , 60, 5 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 0.500 , 60, 5 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.647 , 1.000 , 60, 5 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.641 , 1.000 , 60, 5 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.683 , 1.000 , 60, 5 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.689 , 1.000 , 60, 5 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0

11
Experimental Conditions (zaidi paradigm)/OneEnd_4_CHROS_3axis.txt

@ -0,0 +1,11 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.647 , 1.000 , 60, 3 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ,
20, 0.641 , 1.000 , 60, 3 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ,
20, 0.683 , 1.000 , 60, 3 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ,
20, 0.689 , 1.000 , 60, 3 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ,

10
Experimental Conditions (zaidi paradigm)/OneEnd_5_CHROS_3axis.txt

@ -0,0 +1,10 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.000 , 60, 3 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ,
20, 0.665 , 2.000 , 60, 3 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ,
20, 0.665 , 3.000 , 60, 3 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ,
20, 0.665 , 0.647 , 60, 3 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ,
20, 0.665 , 0.500 , 60, 3 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ,

BIN
Experimental Conditions (zaidi paradigm)/Others/.DS_Store vendored

Binary file not shown.

2
Experimental Conditions (zaidi paradigm)/Others/01 Backgr_EEW_9axes_4cont.txt

@ -0,0 +1,2 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis, s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.00 , 60, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1

5
Experimental Conditions (zaidi paradigm)/Others/02 Backgr_4chro_9axes_2cont.txt

@ -0,0 +1,5 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.353 , 60, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1
20, 0.665 , 0.647 , 60, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1
20, 0.647 , 1.000 , 60, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1
20, 0.683 , 1.000 , 60, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1

11
Experimental Conditions (zaidi paradigm)/Others/MT_OneEnd_4_CHROS_3axis.txt

@ -0,0 +1,11 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.647 , 1.000 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.641 , 1.000 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.683 , 1.000 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.689 , 1.000 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0

10
Experimental Conditions (zaidi paradigm)/Others/MT_OneEnd_5_CHROS_3axis.txt

@ -0,0 +1,10 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.000 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 2.000 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 3.000 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 0.647 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 0.500 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0

5
Experimental Conditions (zaidi paradigm)/Others/Prueba_ReadTable.txt

@ -0,0 +1,5 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.10 , 60, 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 1.40 , 60, 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 1.00 , 60, 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 1.40 , 60, 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0

6
Experimental Conditions (zaidi paradigm)/Others/TEST01 Backgr_5chro_9axes_1cont.txt

@ -0,0 +1,6 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.000 , 60, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1
20, 0.665 , 1.353 , 60, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1
20, 0.665 , 0.647 , 60, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1
20, 0.647 , 1.000 , 60, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1
20, 0.683 , 1.000 , 60, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1

19
Experimental Conditions (zaidi paradigm)/Others/TESTING 13_CHROS_1axis.txt

@ -0,0 +1,19 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.000 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 1.176 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 1.353 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 1.500 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 0.824 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 0.647 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 0.500 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.656 , 1.000 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.647 , 1.000 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.641 , 1.000 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.674 , 1.000 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.683 , 1.000 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.689 , 1.000 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0

19
Experimental Conditions (zaidi paradigm)/Others/TESTING 13_CHROS_2axes.txt

@ -0,0 +1,19 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.000 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 1.176 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 1.353 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 1.500 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 0.824 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 0.647 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 0.500 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.656 , 1.000 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.647 , 1.000 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.641 , 1.000 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.674 , 1.000 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.683 , 1.000 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.689 , 1.000 , 60, 3 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0

5
Experimental Conditions (zaidi paradigm)/Others/TESTING ClosestEEW-Chro ColorBackgr.txt

@ -0,0 +1,5 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.176 , 100, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1
20, 0.665 , 0.824 , 100, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1
20, 0.656 , 1.000 , 100, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1
20, 0.674 , 1.000 , 100, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1

6
Experimental Conditions (zaidi paradigm)/Others/TESTING Middle-Chro ColorBackgr.txt

@ -0,0 +1,6 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.000 , 100, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1
20, 0.665 , 1.353 , 100, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1
20, 0.665 , 0.647 , 100, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1
20, 0.647 , 1.000 , 100, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1
20, 0.683 , 1.000 , 100, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1

6
Experimental Conditions (zaidi paradigm)/Others/TESTING MostExtreme-Chro ColorBackgr.txt

@ -0,0 +1,6 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.000 , 100, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1
20, 0.665 , 1.5 , 100, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1
20, 0.665 , 0.5 , 100, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1
20, 0.641 , 1.000 , 100, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1
20, 0.689 , 1.000 , 100, 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1

19
Experimental Conditions (zaidi paradigm)/Others/TESTING_OneEnd_13_CHROS_1axis.txt

@ -0,0 +1,19 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.000 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 1.176 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 1.353 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 1.500 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 0.824 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 0.647 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 0.500 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.656 , 1.000 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.647 , 1.000 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.641 , 1.000 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.674 , 1.000 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.683 , 1.000 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.689 , 1.000 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0

14
Experimental Conditions (zaidi paradigm)/Others/TESTING_OneEnd_7_CHROS_1axis(1).txt

@ -0,0 +1,14 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.000 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 1.176 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 1.353 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 1.500 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 0.824 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 0.647 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 0.500 , 60, 3 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0

14
Experimental Conditions (zaidi paradigm)/Others/TESTING_OneEnd_7_CHROS_1axis(2).txt

@ -0,0 +1,14 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.000 , 60, 3 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.656 , 1.000 , 60, 3 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.647 , 1.000 , 60, 3 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.641 , 1.000 , 60, 3 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.674 , 1.000 , 60, 3 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.683 , 1.000 , 60, 3 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.689 , 1.000 , 60, 3 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0

9
Experimental Conditions (zaidi paradigm)/Others/TESTT copy.txt

@ -0,0 +1,9 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis, s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.000 , 60, 2 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0

9
Experimental Conditions (zaidi paradigm)/Others/TESTT.txt

@ -0,0 +1,9 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis, s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.000 , 60, 3 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0

13
Experimental Conditions (zaidi paradigm)/Others/TEST_Chros_OtherContrasts.txt

@ -0,0 +1,13 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis, s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.000 , 60, 3 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 3.000 , 60, 3 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.665 , 0.500 , 60, 3 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.641 , 1.000 , 60, 3 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0
20, 0.689 , 1.000 , 60, 3 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0

9
Experimental Conditions (zaidi paradigm)/Others/TEST_lAxis_Contrast.txt

@ -0,0 +1,9 @@
Luminance , Chro_littL , Chro_littS , AdaptTime, nRep, l_axis, s_axis , lum_axis , l_s_45 , l_s_135 , lum_l_45 , lum_l_135 , lum_s_45 , lum_s_135
20, 0.665 , 1.000 , 60, 5 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save