#!/bin/tcsh

### Script for Part 8 of AFNI Time Series Analysis videos
### - Show the effects of bandpassing by creating a
###   white noise file, then filtering it
### - Results are plotted in file s8a.png

# create a white noise time series (in a column of numbers)

1dgenARMA11 -seed 666 -num 201 -a 0.0 -b 0.0  > s8a.junk.1D

# add some drift to it (J1 = Bessel function, just for fun)

1deval -a s8a.junk.1D -expr 'a+J1(t/22)'      > s8a.WHITE.1D

# bandpass the result
#  Note the use of \' to transpose the input column-oriented
#  s8a.WHITE.1D file to be row-oriented, as AFNI 3d programs
#  treat each row as a voxel when reading text files as
#  datasets - so going along a row is 'time', and going down
#  a column is 'space'.

3dTproject -input s8a.WHITE.1D\' -TR 1.0 \
           -prefix stdout: -bandpass 0.01 0.1 > s8a.BPASS.1D

# plot the input and bandpassed result together

1dplot -one -png s8a.png      \
       -ynames White Bandpass \
       -dashed 3:1 -THICK s8a.WHITE.1D s8a.BPASS.1D

# throw out the trash

\rm s8a*.1D
