Permalink
Browse files

Correct slope value

  • Loading branch information...
1 parent 953d788 commit 86b8719d72ec947cb1ce33d29dc1d4a113a78e6c @helenegauchou committed Oct 2, 2012
View
2 Exp.m
@@ -1 +1 @@
-function Exp(search_type,target_presence,setsize,ISI)global win0 win1 win2 winclear winCue winFeedback global response_detection accuracy_detectionglobal response_time response_time_logglobal excentricity quadrantmatrix_settings;global_settings;% Shape list % *******************************************************************************************************************************shapes = {'short_line','long_line','T_bar_left','T_bar_right','circle'};shape_fixation_dot = 'disc';% Spatial locations for items ****************************************************************************************************************matlocperm = func_location(setsize);% Creates screen's items' color and shapes ******************************************************************************************************permstsz = randperm(setsize);target = permstsz(1); % defines target% draws shapes win1 & win2if target_presence == settings.TARGET_ABSENT; for i=1:setsize drawshapes(win1,shapes{1},matlocperm(i,1),matlocperm(i,2),settings.NON_TARGETS_COLOR); drawshapes(win2,shapes{3},matlocperm(i,1),matlocperm(i,2),settings.NON_TARGETS_COLOR); endelse if search_type == settings.FEATURE_SEARCH for i=1:setsize if i == target drawshapes(win1,shapes{2},matlocperm(i,1),matlocperm(i,2),settings.TARGET_COLOR); else drawshapes(win1,shapes{1},matlocperm(i,1),matlocperm(i,2),settings.NON_TARGETS_COLOR); end end end if search_type == settings.CONJUNCTION_SEARCH for i=1:setsize if i ~= target drawshapes(win2,shapes{3},matlocperm(i,1),matlocperm(i,2),settings.NON_TARGETS_COLOR); end if i == target drawshapes(win2,shapes{4},matlocperm(i,1),matlocperm(i,2),settings.TARGET_COLOR); end end endend% Creates cue screenif search_type == settings.FEATURE_SEARCH cue = shapes{1}; xCue = (settings.SCREEN_X/2)-2; yCue = (settings.SCREEN_Y/2)+(settings.LENGTH_SHORT_LINE/2);else cue = shapes{3}; xCue = (settings.SCREEN_X/2)-(settings.LENGTH_SHORT_LINE/2); yCue = (settings.SCREEN_Y/2)+(settings.LENGTH_LONG_LINE/2);enddrawshapes(winCue,cue,xCue,yCue,settings.NON_TARGETS_COLOR);drawshapes(winCue,shapes{5},settings.SCREEN_X/2, settings.SCREEN_Y/2,settings.NON_TARGETS_COLOR);% target's location with center of the screen as reference ************% for data exportif target_presence == 1 X_loc_target = (matlocperm(target,1) - settings.SCREEN_X/2)/settings.CM; Y_loc_target = (matlocperm(target,2) - settings.SCREEN_Y/2)/settings.CM; excentricity = ceil(sqrt(X_loc_target^2 + Y_loc_target^2)); half_screen_X = 1; half_screen_Y = 0; if (X_loc_target > 0) half_screen_X = 2; end if (Y_loc_target > 0) half_screen_Y = 2; end quadrant = half_screen_X + half_screen_Y;endif target_presence == 0 excentricity = CONST_no_value; quadrant = CONST_no_value;end% TRIAL BEGINS HERE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Displays CUE screen ***************************************************************************************************************************Screen(win0,'WaitBlanking');Screen('CopyWindow',winCue,win0);Screen(win0,'WaitBlanking',settings.DURATION_CUE);% Displays BLACK screen *************************************************************************************************************************DURATION_BLANK_1 = ISI - settings.DURATION_FIX - settings.DURATION_BLANK_2;Screen(win0,'WaitBlanking');Screen('CopyWindow',winclear,win0);Screen(win0,'WaitBlanking',DURATION_BLANK_1);% Displays FIXATION POINT screen ****************************************************************************************************************Screen(win0,'WaitBlanking');drawshapes(win0,shapes{5},settings.SCREEN_X/2, settings.SCREEN_Y/2,settings.NON_TARGETS_COLOR);Screen(win0,'WaitBlanking',settings.DURATION_FIX);% Displays BLACK screen *************************************************************************************************************************Screen(win0,'WaitBlanking');Screen('CopyWindow',winclear,win0);Screen(win0,'WaitBlanking',settings.DURATION_BLANK_2);% Displays TEST Screen *************************************************************************************************************************FlushEvents('keyDown');Screen(win0,'WaitBlanking');if search_type == settings.FEATURE_SEARCH Screen('CopyWindow',win1,win0);elseif search_type == settings.CONJUNCTION_SEARCH Screen('CopyWindow',win2,win0);endtrial_start_time = tic;while 1 if KbCheck == 1 response_time = round((toc(trial_start_time))*1000); key = GetChar; if (lower(key) == settings.LEFT_RESPONSE_KEY)||(lower(key) == settings.RIGHT_RESPONSE_KEY) break end endendScreen('CopyWindow',winclear,win0);response_time_log = log10(response_time);% response coding ---------------------------------------------------------if lower(key) == settings.LEFT_RESPONSE_KEY response_detection = settings.TARGET_ABSENT; % User didn't detect any targetendif lower(key) == settings.RIGHT_RESPONSE_KEY response_detection = settings.TARGET_PRESENT; % User detected a targetend% accuracy coding -----------------------------------------------------accuracy_detection = (target_presence == response_detection);% Displays FEEDBACK screen *****************************************************************************************************************if accuracy_detection == 0 error_message_color = settings.LETTER_COLOR_wrong;else error_message_color = settings.LETTER_COLOR_right;enddrawshapes(winFeedback,shapes{5},settings.SCREEN_X/2, settings.SCREEN_Y/2,error_message_color);Screen(win0,'WaitBlanking');Screen('CopyWindow',winFeedback,win0);Screen(win0,'WaitBlanking',settings.DURATION_ERROR_MESSAGE);% Displays BLACK screen ( = ITI = Inter Trial Interval)*************************************************************************************%ITI = (ceil(1350 - (settings.DURATION_ERROR_MESSAGE - settings.DURATION_CUE - ISI)*(1000/60)))/(1000/60);Screen(win0,'WaitBlanking');Screen('CopyWindow',winclear,win0);Screen(win0,'WaitBlanking',settings.DURATION_ITI);% clear the windowsScreen('CopyWindow',winclear,win0);Screen('CopyWindow',winclear,win1);Screen('CopyWindow',winclear,win2);Screen('CopyWindow',winclear,winCue);Screen('CopyWindow',winclear,winFeedback);end
+function [response_detection accuracy_detection response_time response_time_log excentricity quadrant] =... Exp(search_type,target_presence,setsize,ISI)global win0 win1 win2 winclear winCue winFeedback matrix_settings;global_settings;% Shape list % *******************************************************************************************************************************shapes = {'short_line','long_line','T_bar_left','T_bar_right','circle'};% Spatial locations for items ****************************************************************************************************************matlocperm = func_location(setsize);% Creates screen's items' color and shapes ******************************************************************************************************permstsz = randperm(setsize);target = permstsz(1); % defines target% draws shapes win1 & win2if target_presence == settings.TARGET_ABSENT; for i=1:setsize drawshapes(win1,shapes{1},matlocperm(i,1),matlocperm(i,2),settings.NON_TARGETS_COLOR); drawshapes(win2,shapes{3},matlocperm(i,1),matlocperm(i,2),settings.NON_TARGETS_COLOR); endelse if search_type == settings.FEATURE_SEARCH for i=1:setsize if i == target drawshapes(win1,shapes{2},matlocperm(i,1),matlocperm(i,2),settings.TARGET_COLOR); else drawshapes(win1,shapes{1},matlocperm(i,1),matlocperm(i,2),settings.NON_TARGETS_COLOR); end end end if search_type == settings.CONJUNCTION_SEARCH for i=1:setsize if i ~= target drawshapes(win2,shapes{3},matlocperm(i,1),matlocperm(i,2),settings.NON_TARGETS_COLOR); end if i == target drawshapes(win2,shapes{4},matlocperm(i,1),matlocperm(i,2),settings.TARGET_COLOR); end end endend% Creates cue screenif search_type == settings.FEATURE_SEARCH cue = shapes{1}; xCue = (settings.SCREEN_X/2)-2; yCue = (settings.SCREEN_Y/2)+(settings.LENGTH_SHORT_LINE/2);else cue = shapes{3}; xCue = (settings.SCREEN_X/2)-(settings.LENGTH_SHORT_LINE/2); yCue = (settings.SCREEN_Y/2)+(settings.LENGTH_LONG_LINE/2);enddrawshapes(winCue,cue,xCue,yCue,settings.NON_TARGETS_COLOR);drawshapes(winCue,shapes{5},settings.SCREEN_X/2, settings.SCREEN_Y/2,settings.NON_TARGETS_COLOR);% target's location with center of the screen as reference for data exportif target_presence == 1 X_loc_target = (matlocperm(target,1) - settings.SCREEN_X/2)/settings.CM; Y_loc_target = (matlocperm(target,2) - settings.SCREEN_Y/2)/settings.CM; excentricity = ceil(sqrt(X_loc_target^2 + Y_loc_target^2)); half_screen_X = 1; half_screen_Y = 0; if (X_loc_target > 0) half_screen_X = 2; end if (Y_loc_target > 0) half_screen_Y = 2; end quadrant = half_screen_X + half_screen_Y;endif target_presence == 0 excentricity = CONST_no_value; quadrant = CONST_no_value;end% TRIAL BEGINS HERE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Displays CUE screen ***************************************************************************************************************************Screen(win0,'WaitBlanking');Screen('CopyWindow',winCue,win0);Screen(win0,'WaitBlanking',settings.DURATION_CUE);% Displays BLACK screen *************************************************************************************************************************DURATION_BLANK_1 = ISI - settings.DURATION_FIX - settings.DURATION_BLANK_2;Screen(win0,'WaitBlanking');Screen('CopyWindow',winclear,win0);Screen(win0,'WaitBlanking',DURATION_BLANK_1);% Displays FIXATION POINT screen ****************************************************************************************************************Screen(win0,'WaitBlanking');drawshapes(win0,shapes{5},settings.SCREEN_X/2, settings.SCREEN_Y/2,settings.NON_TARGETS_COLOR);Screen(win0,'WaitBlanking',settings.DURATION_FIX);% Displays BLACK screen *************************************************************************************************************************Screen(win0,'WaitBlanking');Screen('CopyWindow',winclear,win0);Screen(win0,'WaitBlanking',settings.DURATION_BLANK_2);% Displays TEST Screen *************************************************************************************************************************FlushEvents('keyDown');Screen(win0,'WaitBlanking');if search_type == settings.FEATURE_SEARCH Screen('CopyWindow',win1,win0);elseif search_type == settings.CONJUNCTION_SEARCH Screen('CopyWindow',win2,win0);endtrial_start_time = tic;while 1 if KbCheck == 1 response_time = round((toc(trial_start_time))*1000); key = GetChar; if (lower(key) == settings.LEFT_RESPONSE_KEY)||(lower(key) == settings.RIGHT_RESPONSE_KEY) break end endendScreen('CopyWindow',winclear,win0);response_time_log = log10(response_time);% response coding ---------------------------------------------------------if lower(key) == settings.LEFT_RESPONSE_KEY response_detection = settings.TARGET_ABSENT;endif lower(key) == settings.RIGHT_RESPONSE_KEY response_detection = settings.TARGET_PRESENT;end% accuracy coding -----------------------------------------------------accuracy_detection = (target_presence == response_detection);% Displays FEEDBACK screen *****************************************************************************************************************if accuracy_detection == 0 error_message_color = settings.LETTER_COLOR_wrong;else error_message_color = settings.LETTER_COLOR_right;enddrawshapes(winFeedback,shapes{5},settings.SCREEN_X/2, settings.SCREEN_Y/2,error_message_color);Screen(win0,'WaitBlanking');Screen('CopyWindow',winFeedback,win0);Screen(win0,'WaitBlanking',settings.DURATION_ERROR_MESSAGE);% Displays BLACK screen ( = ITI = Inter Trial Interval)*************************************************************************************%ITI = (ceil(1350 - (settings.DURATION_ERROR_MESSAGE - settings.DURATION_CUE - ISI)*(1000/60)))/(1000/60);Screen(win0,'WaitBlanking');Screen('CopyWindow',winclear,win0);Screen(win0,'WaitBlanking',settings.DURATION_ITI);% clear the windowsScreen('CopyWindow',winclear,win0);Screen('CopyWindow',winclear,win1);Screen('CopyWindow',winclear,win2);Screen('CopyWindow',winclear,winCue);Screen('CopyWindow',winclear,winFeedback);end
@@ -1,6 +0,0 @@
-1,1,1,1,1,1,0,7,1,99,1,0,519,2.7152,99,99
-1,1,1,1,1,1,1,11,2,99,1,1,422,2.6253,3,3
-1,1,1,1,1,1,1,3,3,99,1,1,184,2.2648,4,3
-1,1,1,1,1,1,0,3,4,99,1,0,379,2.5786,99,99
-1,1,1,1,1,1,1,7,5,99,1,1,342,2.534,3,4
-1,1,1,1,1,1,0,11,6,99,1,0,321,2.5065,99,99
View
Binary file not shown.
@@ -1,7 +1,11 @@
-function final_feedback(task_type,number_of_trial,MATRIX_data)
+function [global_accuracy_rate global_accuracy_rate_FEATURE global_accuracy_rate_CONJUNCTION] = func_final_feedback(task_type,number_of_trial,MATRIX_data)
global win0 winclear
-global global_accuracy_rate global_accuracy_rate_FEATURE global_accuracy_rate_CONJUNCTION
+%global global_accuracy_rate global_accuracy_rate_FEATURE global_accuracy_rate_CONJUNCTION
+
+global_accuracy_rate = 0;
+global_accuracy_rate_FEATURE = 0;
+global_accuracy_rate_CONJUNCTION = 0;
matrix_settings;
global_settings;
@@ -191,8 +195,8 @@ function final_feedback(task_type,number_of_trial,MATRIX_data)
l=l+1;
matRT_HIT_FEATURE (1,l)= average_RT_FEATURE_HIT_setsize;
- matRT_HIT_CONJUNCTION (1,l)= average_RT_FEATURE_CR_setsize;
- matRT_CR_FEATURE (1,l)= average_RT_CONJUNCTION_HIT_setsize;
+ matRT_HIT_CONJUNCTION (1,l)= average_RT_CONJUNCTION_HIT_setsize;
+ matRT_CR_FEATURE (1,l)= average_RT_FEATURE_CR_setsize;
matRT_CR_CONJUNCTION (1,l)= average_RT_CONJUNCTION_CR_setsize;
end
View
@@ -1,7 +1,7 @@
-function func_questions
+function [ID question_ID_subject part_number question_part_number task_type search_type block_number ISI number_of_trial] = func_questions
global win0 winclear
-global ID question_ID_subject part_number task_type search_type block_number ISI number_of_trial question_part_number
+%global ID question_ID_subject part_number task_type search_type block_number ISI number_of_trial question_part_number
HideCursor;
@@ -1,18 +1,11 @@
-function training(task_type,search_type,ISI)
-
-global response_detection accuracy_detection response_time
-global global_accuracy_rate global_accuracy_rate_FEATURE global_accuracy_rate_CONJUNCTION
+function func_training(task_type,search_type,ISI)
matrix_settings;
global_settings;
training = 0;
-global_accuracy_rate = 0;
-global_accuracy_rate_FEATURE = 0;
-global_accuracy_rate_CONJUNCTION = 0;
while training == 0;
-
% Instructions reminder
readytostart;
@@ -36,7 +29,8 @@ function training(task_type,search_type,ISI)
current_trial_parameters = MATRIX_block_training(current_trial,:);
else
current_trial_parameters = get_matrix_line(current_trial, MATRIX_block_training(:,:,settings.FEATURE_SEARCH), MATRIX_block_training(:,:,settings.CONJUNCTION_SEARCH));
- end
+ end
+ [response_detection accuracy_detection response_time ] = ...
Exp(current_trial_parameters(1,1),...
current_trial_parameters(1,2),...
current_trial_parameters(1,3),...
@@ -58,7 +52,8 @@ function training(task_type,search_type,ISI)
end
% POST BLOCK FEEDBACK *****************************************************
- final_feedback(task_type,number_of_trial,MATRIX_data_training);
+ [global_accuracy_rate global_accuracy_rate_FEATURE global_accuracy_rate_CONJUNCTION] = ...
+ func_final_feedback(task_type,number_of_trial,MATRIX_data_training);
if task_type == settings.BLOCKED_SEARCH
if global_accuracy_rate >= 90
Oops, something went wrong.

0 comments on commit 86b8719

Please sign in to comment.