123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- #!/bin/tcsh
- # try to find reasonable random event related timing given the experimental
- # parameters
- # ---------------------------------------------------------------------------
- # some experiment parameters (most can be inserted directly into the
- # make_random_timing.py command)
- # ---------------------------------------------------------------------------
- # execution parameters
- set iterations = 10 # number of iterations to compare
- set seed = 1234567 # initial random seed
- set outdir = stim_results # directory that all results are under
- set LCfile = NSD_sums # file to store norm. std. dev. sums in
- # set pattern = LC # search pattern for LC[0], say
- set pattern = 'norm. std.' # search pattern for normalized stdev vals
- # ===========================================================================
- # start the work
- # ===========================================================================
- # ------------------------------------------------------------
- # recreate $outdir each time
- if ( -d $outdir ) then
- echo "** removing output directory, $outdir ..."
- \rm -fr $outdir
- endif
- echo "++ creating output directory, $outdir ..."
- mkdir $outdir
- if ( $status ) then
- echo "failure, cannot create output directory, $outdir"
- exit
- endif
- # move into the output directory and begin work
- cd $outdir
- # create empty LC file
- echo -n "" > $LCfile
- echo -n "iteration (of $iterations): 0000"
- # ------------------------------------------------------------
- # run the test many times
- foreach iter (`count -digits 4 1 $iterations`)
- # make some other random seed
- @ seed = $seed + 1
- # create randomly ordered stimulus timing files
- # (consider: -tr_locked -save_3dd_cmd tempfile)
- make_random_timing.py -num_runs 4 -run_time 690 \
- -tr 2 \
- -pre_stim_rest 0 -post_stim_rest 10 \
- -rand_post_stim_rest no \
- -add_timing_class stim 12 \
- -add_timing_class tnull 10 \
- -add_timing_class rest 0.5 1.5 4 dist=decay_fixed \
- -add_stim_class NMA 10 stim rest \
- -add_stim_class NMS 10 stim rest \
- -add_stim_class HMA 10 stim rest \
- -add_stim_class HMS 10 stim rest \
- -add_stim_class NULL 14 tnull INSTANT \
- -prefix threat_app.$iter \
- # \
- # might not need to edit below here... \
- -write_event_list events.$iter.txt \
- -show_timing_stats \
- -seed $seed \
- -save_3dd_cmd cmd.3dd.$iter.txt >& out.mrt.$iter
- # consider: sed 's/GAM/"TENT(0,15,7)"/' tempfile > cmd.3dd.$iter
- # rm -f tempfile
- # now evaluate the stimulus timings
- tcsh cmd.3dd.$iter.txt >& out.3dD.$iter
- # save the sum of the 3 LC values
- set nums = ( `awk -F= '/'"$pattern"'/ {print $2}' out.3dD.${iter}` )
- # make a quick ccalc command
- set sstr = $nums[1]
- foreach num ( $nums[2-] )
- set sstr = "$sstr + $num"
- end
- set num_sum = `ccalc -expr "$sstr"`
- echo -n "$num_sum = $sstr : " >> $LCfile
- echo "iteration $iter, seed $seed" >> $LCfile
- echo -n "\b\b\b\b$iter"
- end
- echo ""
- echo "done, results are in '$outdir', LC sums are in '$LCfile'"
- echo consider the command: "sort -n $outdir/$LCfile | head -1"
- # note that if iter 042 seems to be the best, consider these commands:
- #
- # cd stim_results
- # set iter = 042
- # timing_tool.py -multi_timing stimes.${iter}_0* \
- # -run_len $run_lengths -multi_stim_dur $stim_durs \
- # -multi_show_isi_stats
- # tcsh cmd.3dd.$iter
- # 1dplot X.xmat.1D'[6..$]'
- # 1dplot sum_ideal.1D
- #
- # - timing_tool.py will give useful statistics regarding ISI durations
- # (should be similar to what is seen in output file out.mrt.042)
- # - run cmd.3dd.$iter to regenerate that X martix (to create actual regressors)
- # - the first 1dplot command will show the actual regressors
- # (note that 6 = 2*$num_runs)
- # - the second will plot the sum of the regressor (an integrity check)
- # (note that sum_ideal.1D is produced by cmd.3dd.$iter, along with X.xmat.1D)
|