Hi,
I'm sorry, I don't quite understand. I have removed the nums 5 and 6, but I thought since I have four stimuli, I would need all 6 contrasts.
Also, I have made a new contrast folder to put the contrasts in. Right now I have contrasts (for my four stim types ABCD):
contrast_AB 0 0 1 -1 0 0
contrast_BC 0 0 0 1 -1 0
contrast_AC 0 0 1 0 -1 0
contrast_ABCD 0 0 1 1 1 -1
But it is still coming up: iteration: 000csh: nums: Subscript out of range.
I'm still not sure what I am doing wrong. My new script is below:
#!/bin/tcsh
# experiment parameters
set ts = 119 # length of timeseries
set stim = 4 # number of input stimuli
set num_on = 17 # time points per stimulus (between 0 and $ts/3)
# execution parameters
set iterations = 100 # number of iterations
set seed = 1234567 # initial random seed
set outdir = stim_results
set LCfile = $outdir/LC_sums
# ------------------------------------------------------------
# make sure $outdir exists
if ( ! -d $outdir ) then
mkdir $outdir
if ( $status ) then
echo "failure, cannot create output directory, $outdir"
exit
endif
endif
# create empty LC file
echo -n "" > $LCfile
echo -n "iteration: 000"
# ------------------------------------------------------------
# run the test many times
foreach iter (`count -digits 3 1 $iterations`)
# make some other random seed
@ seed = $seed + 1
# create random order stim files
RSFgen -nt ${ts} \
-num_stimts ${stim} \
-nreps 1 ${num_on} \
-nreps 2 ${num_on} \
-nreps 3 ${num_on} \
-nreps 4 34 \
-seed ${seed} \
-prefix RSF.stim.${iter}. >& /dev/null
# from the random order stim files, make ideal reference functions
waver -GAM -dt 2.0 -input RSF.stim.${iter}.1.1D > wav.hrf.${iter}.1.1D
waver -GAM -dt 2.0 -input RSF.stim.${iter}.2.1D > wav.hrf.${iter}.2.1D
waver -GAM -dt 2.0 -input RSF.stim.${iter}.3.1D > wav.hrf.${iter}.3.1D
waver -GAM -dt 2.0 -input RSF.stim.${iter}.4.1D > wav.hrf.${iter}.4.1D
# now evaluate the stimulus timings
3dDeconvolve \
-nodata \
-nfirst 4 \
-nlast 118 \
-polort 1 \
-num_stimts ${stim} \
-stim_file 1 "wav.hrf.${iter}.1.1D" \
-stim_label 1 "stim_A" \
-stim_file 2 "wav.hrf.${iter}.2.1D" \
-stim_label 2 "stim_B" \
-stim_file 3 "wav.hrf.${iter}.3.1D" \
-stim_label 3 "stim_C" \
-stim_file 1 "wav.hrf.${iter}.4.1D" \
-stim_label 1 "stim_D" \
-glt 1 contrasts/contrast_AB \
-glt 1 contrasts/contrast_AC \
-glt 1 contrasts/contrast_BC \
-glt 1 contrasts/contrast_ABCD \
>& 3dD.nodata.${iter}
# save the sum of the 3 LC values
set nums = ( `awk -F= '/LC/ {print $2 * 10000}' 3dD.nodata.${iter}` )
@ num_sum = $nums[1] + $nums[2] + $nums[3] + $nums[4]
echo -n "$num_sum = $nums[1] + $nums[2] + $nums[3] + $nums[4] : " >> $LCfile
echo "iteration $iter, seed $seed" >> $LCfile
mv RSF.stim.*.1D wav.hrf.*.1D 3dD.nodata* $outdir
echo -n "\b\b\b$iter"
end
echo ""
echo "done, results are in '$outdir', LC sums are in '$LCfile'"
echo consider the command: "sort $LCfile | head -1"
Thanks,
Erin