Making SU Traces from ASCII Data
#!/bin/sh
# assume we are already in scripts directory
DATA=../sudata
# get total number of traces to make, samples per trace, sample interval in micro-seconds
# and base filename to use
nt=$1
nsamp=$2
dt=$3
file=$4
printf "Making %d traces in %s\n" ${nt} ${DATA}/${file}.asc
printf " with %d samples, and sampling interval of %d micro-seconds\n" ${nsamp} ${dt}
# initialize trace count and sample count
i=0
j=0
# remove file because we are appending
rm ${DATA}/${file}.asc
# loop until nsamp times nt samples are done
while [ ${i} -lt ${nt} ]
do
while [ ${j} -lt ${nsamp} ]
do
j=`echo ${j}+1|bc`
printf "%d\n" ${j} >> ${DATA}/${file}.asc
done
j=0
i=`echo ${i}+1|bc`
done
# convert ASCII to binary, one sample per line, use .bin extension
a2b n1=1 <$DATA/${file}.asc >$DATA/${file}.bin
# add trace headers
suaddhead ns=${nsamp} < $DATA/trace.bin | sushw key=dt a=${dt} >$DATA/trace.su