% === Analysis pipeline for the Visual Search project === % this file contains references to the main functions and comments about % how they should be used. %% specify the base directory for this system so that the code works ==== % temporarily here to make it easier for CK to switch systems @home switch computer case 'MACI64' ThisSystem = 'CK-MBP'; case 'GLNXA64' ThisSystem = 'CK-Home-Lin'; % specify for your own system: add case end switch ThisSystem case 'CK-NIN-Lin' fld.basedir = '/home/chris/Desktop/VISUAL_SEARCH/MANUSCRIPT/Data_and_Code/DATA'; case 'CK-Home-Lin' fld.basedir = '/home/chris/Desktop/VISUAL_SEARCH/MANUSCRIPT/Data_and_Code/DATA'; case 'CK-MBP' fld.basedir = ['/Volumes/OSX/Users/chris/Dropbox/CURRENT_PROJECTS/'... 'MONKEY_EPHYS/VISUAL_SEARCH/MANUSCRIPT/Data_and_Code/DATA']; % specify for your own system: add case end fld.procdatadir = fullfile(fld.basedir,'Processed_Data'); fprintf('=============================================================\n') fprintf(['System used: ' ThisSystem '\n']) fprintf(['Basedir used: ' fld.basedir '\n']) fprintf('=============================================================\n') % info -- addpath(genpath(fullfile(pwd,'info'))); % subfunctions -- addpath(genpath(fullfile(pwd,'functions'))); addpath(genpath(fullfile(pwd,'figfunctions'))); %% individual session analysis ========================================== % Store individual % channels from individual sessions as individual files, % such that they can easily be concatenated. % LOG data are stored as LUTs (tables) that can be concatenated easily. if false % avoid running this redundantly % the following function returns a master list of all dates, that can be % used to load data datainfo = session_info(); %#ok<*UNRCH> % the following function loads the data, extracts all necessary % information and stores it in a more flexible format (a LUT). % It also preprocesses env data. The data is stored per channel. sessions = datainfo(1).dates; analyse_individual_sessions(fld, 'M1',sessions); sessions = datainfo(2).dates; analyse_individual_sessions(fld, 'M2',sessions); end %% adjust saved data ==================================================== % we added goodtrials as an array, but it needs to be a cell array because % it doesn't have the same number of fields between sessions (so it can't % be concatenated). let's fix it once, using this function, so we don't % have to re-run analyse_individual_sessions. if false % avoid running this redundantly modify_mp(fld,'M1',datainfo(1).dates); modify_mp(fld,'M2',datainfo(2).dates); % there is an issue with the LUTs, namely that sometimes stimonset and % targonset are empty (we created the LUTs by converting log files into a % table. let's fix those. fix_lut(fld,'M1'); fix_lut(fld,'M2'); end %% extra info =========================================================== % this script loads data from the usable channels (i.e. channels that at % some point have a stimulus in their RF) and compares the SNR, to get a % better idea of which channels we can use. if false % avoid running this redundantly check_snr_over_sessions(fld,'M1',false); check_snr_over_sessions(fld,'M2',false); end %% figure behavior ====================================================== % behavior figure_behavior(fld); %% output some general numbers for the methods section ================== methods_numbers(fld) %% figure neurotrace ==================================================== % this figure shows the main result, namely that responses to targets are % enhanced and responses to distractors are supressed, both compared to % nontargets. this function also estimates the latency. if false % run prep-script for si = 1:2 figure_neurotrace_prepare(fld,['M' num2str(si)],true); end end figure_neurotrace(fld) %% figure binmod ======================================================== % do a binned version of the modulation plots figure_binmod(fld); %% figure neurobar ====================================================== % this figure is a sort of extension of figure_neurotrace we show the % responses for when the monkey is correct (i.e. he chose the target, not % the nontarget or the distractor). Here we only look at bar plots % of averages in a window, but we add conditions in which the monkey was % incorrect (he chose either nontarget or distractor), and if he chose % nontarget, also we compare when that particular nontarget was in the RF % vs when it wasn't. % limit trials to include ------------------------------------------------- % % do all possible combination in a loop --- % % by reactiontime % for rt=[0 -1 1] % limit.ReactionTime = rt; % % set to -1 (for lower) or +1 (for higher) or 0 for none at all % limit.ReactimeTimePerc = 30; % percentile % for dct = [0 1] % % by distance from target on error trials % limit.DistChoiceToTarget = dct; % % dctr=[1 1; 2 3]; % for i=1:2 % limit.DistChoiceToTarget_range = dctr(i,:); % [min max] % % for dcs = [0 1] % % by distance from SD on error trials % limit.DistChoiceToSD = dcs; % % dcsr=[1 1; 2 3]; % for j=1:2 % limit.DistChoiceToSD_range = dcsr(j,:); % [min max] % % limit.PlotBehavior = false; % % ------------------------------------------------------------------------- % % figure_neurobar_prepare(fld,'M1', limit); % figure_neurobar_prepare(fld,'M2', limit); % figure_neurobar(fld, limit); % end % end % end % end % end limit.ReactionTime = 0; % set to -1 (for lower) or +1 (for higher) or 0 for none at all limit.ReactimeTimePerc = 30; % percentile % by distance from target on error trials limit.DistChoiceToTarget = 0; limit.DistChoiceToTarget_range = [1 1]; % [min max] % by distance from SD on error trials limit.DistChoiceToSD = 0; limit.DistChoiceToSD_range = [1 1]; % [min max] limit.PlotBehavior = false; % ------------------------------------------------------------------------- figure_neurobar_prepare(fld,'M1', limit); figure_neurobar_prepare(fld,'M2', limit); figure_neurobar(fld, limit); %% figure priming (behavior and RT color same/swap high/low reward) ===== figure_priming_color(fld) figure_priming_shape(fld) figure_priming_col_vs_shape(fld) %% figure neuropriming (neuronal effect of shape/color swap ============= figure_neuropriming_prepare(fld,'M1') figure_neuropriming_prepare(fld,'M2') figure_neuropriming(fld) %% figure saccadic response times (SRT) ================================= figure_SRT(fld)