get_exp_info.m Specifies some basic properties of an fMRI experiment design matrix. The default version of this script accommodates a slightly mutated 2 factor design with multiple levels in each factor. However, the number of factors/levels that enter into the design matrix can easily be modified either at this stage or in simulate_model_protos.m This script was originally written to prepare for a music cognition experiment in which there were trials with primes and targets. Some of the nomenclature for the calculations of prime durations has been retained. Simply think of 'notes' as 'events' in a sequence of priming events preceding a target. This script will also spit back estimates of the experiment duration.
0001 % get_exp_info.m 0002 % 0003 % Specifies some basic properties of an fMRI experiment design matrix. The default 0004 % version of this script accommodates a slightly mutated 2 factor design with 0005 % multiple levels in each factor. However, the number of factors/levels that enter 0006 % into the design matrix can easily be modified either at this stage or in simulate_model_protos.m 0007 % 0008 % This script was originally written to prepare for a music cognition experiment 0009 % in which there were trials with primes and targets. Some of the nomenclature 0010 % for the calculations of prime durations has been retained. Simply think of 0011 % 'notes' as 'events' in a sequence of priming events preceding a target. 0012 % 0013 % This script will also spit back estimates of the experiment duration. 0014 % 0015 0016 % 2003, Petr Janata 0017 0018 clear tinfo 0019 0020 ntt = 0; 0021 0022 % Note: In this example, Factor 1 refers to the prime type and Factor 2 refers 0023 % to an attribute of the target. Other target attributes exist in relation to 0024 % the prime, but these are handled at the next level of model construction, not 0025 % at the level of trial type specification. 0026 % 0027 % If you are not interested in prime/target trial structure, it is easy to 0028 % eliminate one or the other element by forcing the durations of the respective 0029 % element to zero and then not including that element as a condition in the 0030 % model (in simulate_model_protos.m). 0031 0032 ntt = ntt+1; 0033 tinfo.id{ntt} = 'F1L1_F2L1'; % Factor 1, Level 1; Factor 2 Level 1 0034 tinfo.num_trials(ntt) = 2; 0035 0036 ntt = ntt+1; 0037 tinfo.id{ntt} = 'F1L1_F2L2'; % Factor 1, Level 1; Factor 2 Level 2 0038 tinfo.num_trials(ntt) = 2; 0039 0040 ntt = ntt+1; 0041 tinfo.id{ntt} = 'F1L2_F2L1'; % Factor 1, Level 2; Factor 2 Level 1 0042 tinfo.num_trials(ntt) = 2; 0043 0044 ntt = ntt+1; 0045 tinfo.id{ntt} = 'F1L2_F2L2'; % Factor 1, Level 2; Factor 2 Level 2 0046 tinfo.num_trials(ntt) = 2; 0047 0048 ntt = ntt+1; 0049 tinfo.id{ntt} = 'F1L3_F2L1'; % Factor 1, Level 3; Factor 2 Level 1 0050 tinfo.num_trials(ntt) = 0; 0051 0052 ntt = ntt+1; 0053 tinfo.id{ntt} = 'F1L3_F2L2'; % Factor 1, Level 3; Factor 2 Level 2 0054 tinfo.num_trials(ntt) = 0; 0055 0056 ntt = ntt+1; 0057 tinfo.id{ntt} = 'F1L4_F2L1'; % Factor 1, Level 4; Factor 2 Level 1 0058 tinfo.num_trials(ntt) = 0; 0059 0060 ntt = ntt+1; 0061 tinfo.id{ntt} = 'F1L4_F2L2'; % Factor 1, Level 4; Factor 2 Level 2 0062 tinfo.num_trials(ntt) = 0; 0063 0064 ntt = ntt+1; 0065 tinfo.id{ntt} = 'Sil'; % Silence (blank trials) 0066 tinfo.num_trials(ntt) = 0; 0067 0068 trials_per_iteration = sum(tinfo.num_trials); 0069 0070 num_iterations = 1; % Number of iterations through the number of trials 0071 % specified above 0072 0073 nslices = 18; % number of slices to acquire 0074 min_ms_per_slice = 100; % The fastest sampling rate we can go at, i.e. 10 slices/s 0075 0076 TR = nslices*min_ms_per_slice; % The experiment's TR 0077 0078 notes_per_seq = 1; % Number of events in priming sequence 0079 ms_per_note = 30000; % Duration (ms) of each event in priming sequence 0080 resp_period = 15000*2; % Amount of time (ms) allowed for response to target 0081 prime_dur = (notes_per_seq-1)*ms_per_note; % Duration of prime 0082 0083 cue_dur = 500; % Duration of trial type cue 0084 cue_stim_soa_range = [1000 2000]; % Range of asynchronies (ms) between 0085 % trial type cue and trial onset 0086 inter_trial_interval_range = [1*TR 3*TR]*0; % range of times between trials 0087 0088 total_trials = trials_per_iteration * num_iterations 0089 stim_dur = notes_per_seq*ms_per_note + resp_period; % overall trial duration 0090 0091 % Create randomized list of trial type cue to stimulus onset asynchronies 0092 cue_stim_soa_list = ... 0093 rand(1,total_trials)*diff(cue_stim_soa_range)+min(cue_stim_soa_range); 0094 trial_durs = cue_stim_soa_list + stim_dur; 0095 pure_stim_time = sum(trial_durs); 0096 0097 % Create randomized list of inter-trial intervals 0098 iti_list = rand(1,total_trials)*diff(inter_trial_interval_range)+min(inter_trial_interval_range); 0099 total_jitter_time = sum(iti_list); 0100 0101 total_time_s = (pure_stim_time+total_jitter_time)/1000 0102 total_time_min = total_time_s/60 0103 0104 % Construct trial orders for each iteration 0105 0106 trial_type_list = []; 0107 for itt = 1:ntt 0108 trial_type_list(end+1:end+tinfo.num_trials(itt)) = itt; 0109 end % for itt 0110 0111 % Randomly permute the trial type list 0112 trial_list = trial_type_list(randperm(length(trial_type_list))); 0113 0114 % Calculate trial onsets 0115 onsets = cumsum(iti_list + trial_durs)-(iti_list(1)+trial_durs(1)); 0116 0117 % Number of volumes collected for each iteration through the trials 0118 scans_per_iteration = ceil((total_time_s*1000/num_iterations)/TR)