#! /bin/csh -f -e
# Last edited on 2000-05-07 01:55:37 by stolfi

# Apply geometric filtering to the raw curve

set usage = "$0 PIECE VARIANT RAWCURVE BANDLO BANDHI"

set piece = "$1"; shift
set variant = "$1"; shift
set rawcurve = "$1"; shift
set bandLo = "$1"; shift;
set bandHi = "$1"; shift;
if ( $#argv != 0) then
  echo "usage: ${usage}"; exit 1
endif
set dir = "${piece}-${variant}"
set input = "${dir}/${rawcurve}"
set ctype = "g"
set output = "${dir}/${ctype}"

/bin/rm -f ${dir}/${ctype}[0-9][0-9][0-9].{flc,flv,fla,lbl}

set band = ${bandLo}
while ( ${band} <= ${bandHi} ) 
  /n/gnu/bin/nice PZFilter \
    -input ${input} \
    -output ${output} \
    -lambdaMin ${band} -lambdaRatio 2 -nScales 1 \
    -nRepStages 1 \
    -tolStep 0.01 -tolLength 0.25 \
    -maxIter 2000 \
    -verbose \
    -writeRaw
  @ band = ${band} * 2
end