# tacac   May 14/98
# This script runs the analysis program to perform  trace averages 
# based on the normalized locomotor activty in a waveform. 
# The average of frames occurring during the active period of a waveform 
# is created and saved. The average calculated during the inactive period is 
# appended to this file. QM is used to subtract the two frames and show 
# the difference. 

# In this version, the trace average obtained during the inactive 
# phase of the waveform is subtracted from that obtained during waveform 
# activity.

#USAGE: 
# 1. use analysis to set the analysis range and cycles in a waveform, 
# 2. choose this waveform for cycle selection (SCW),
# 3. set cycles in-phase delay and window
# 4. exit analysis saving the modified parameters.
# 5. run this script, eg. tacac mydata newdata bins_acive bins_inactive
if [ $# -ne 4 ]
then
echo "Usage: $0 runfile avgfile bins_active_phase bins_inactive_phase" >&2
exit 1
fi
analysis $1 <<!
sab$3
qqscsntnp100
qqatcgb$2-a

scsyqqsab$4
qqatcgb$2-i

qyy

!
echo "y" | appendrun $2-a $2-i
qm $2-a <<!
t0;0;0;0;0;
rcXA1
rcXA2
rcXA3
rcXA4
rcXA5
rcXA6
q
!
qm $2-a

	



