12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- %%% collect MUA temp files - THINGS
- % v.2-Gemini
- % 2022 P. Papale fecit
- clear all
- addpath(genpath('\_code\code_utils_v2\'));
- % constants
- % monkey = 'monkeyF';
- monkey = 'monkeyN';
- datadir_gen = '\';
- temp_folder = '\_temps\';
- trial_length = .3;
- pre_trial = .1;
- if monkey == 'monkeyN'
- dates = {'20220111','20220112','20220113','20220114'};
- partitions = 1:8;
- else
- dates = {'20240112','20240115','20240116','20240118'};
- partitions = 1:4;
- end
- log_prefix = 'THINGS_';
- ALLMAT = [];
- ALLMUA = [];
- for day = 1:length(dates)
- clear datadir all_folders blocks
- datadir = [datadir_gen,monkey,'\',dates{day},'\'];
- disp(['%%%%%% DAY: ',num2str(day),' ...']);
-
- all_folders = dir(datadir);
- all_folders = all_folders([all_folders(:).isdir]);
- all_folders = all_folders(~ismember({all_folders(:).name},{'.','..'}));
- blocks = length(all_folders);
- for block_number = 1:blocks
- % block_number = str2num(all_folders(b).name(7:end));
- tic
- disp(['%%% Block: ',num2str(block_number),' ...']);
- block_mua = [];
- for partition_idx = partitions
- clear instance_name temp_block_mua
- partition_name = ['partition',num2str(partition_idx),'_B',sprintf('%03.0f', block_number)];
- if isfile([datadir_gen,monkey,temp_folder,'TEMP_MUA_',dates{day},'_',partition_name,'.mat'])
- if partition_idx == 1
- clear temp_MAT
- % load MAT temps
- load([datadir_gen,monkey,temp_folder,'TEMP_MAT_',dates{day},'_B',num2str(block_number),'.mat']);
- ALLMAT = [ALLMAT; temp_MAT];
- end
- % load MUA temps
- load([datadir_gen,monkey,temp_folder,'TEMP_MUA_',dates{day},'_',partition_name,'.mat']);
- block_mua = [block_mua; temp_block_mua];
- disp(['% (Partiton: ',num2str(partition_idx),' done!)']);
- end
- end
- ALLMUA = [ALLMUA block_mua];
- disp(['%%% ... done in: ',num2str(round(toc)),'s'])
- end
- end
- post_trial = trial_length-pre_trial;
- tb =-pre_trial*1000:1:(post_trial)*1000;
- filename = [datadir_gen,monkey,'/',log_prefix,'MUA_trials.mat'];
- save(filename,'ALLMUA','ALLMAT','tb','-v7.3')
- pause(5)
|