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.
120 lines
3.8 KiB
120 lines
3.8 KiB
%%%%%%%%%%%%%%%%% |
|
%%%%%%%%%%%%%%%%% |
|
% 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') |
|
|
|
|
|
|