You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

104 lines
2.8 KiB

function Disp_Color(l_value,s_value,hfpRG,hfpBG,dispTime)
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/mike/Documents/AfterimageOutputs');
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);
if dispTime<70
WaitSecs(dispTime);
else
KbStrokeWait;
end
%WaitSecs(duration)
%
% end
% KbStrokeWait;
Screen('CloseAll')
end