#!/bin/csh if (`flagLoc $argv -help`) then echo "Extraction and Simple Alignment of a Selected Region in 1D Data:" echo " -in inName [test.dat] 1D Input to be Aligned." echo " -ref refName [ref.dat] 1D Data Reference." echo " -out outName [shift.dat] Aligned Result." echo " -shiftName sName [shift.txt] Alignment Parameter Output." echo " -del Delete Temporary Files." echo " -nodel Save Temporary Files (Default)." echo "Spectral Region, ppm Hz pts %:" echo " -x1 x1 [0%]" echo " -xn xn [100%]" echo "Shift Limits and Step Sizes, Integer Points:" echo " -sMin sMinPts [-64]" echo " -sMax sMaxPts [64]" echo " -sStep sStepPts [1]" echo "Notes:" echo " 1. Input Data will be aligned to reference." echo " 2. Input Data and Reference should have the same digital resolution." exit 0 endif set refName = (`getArgD $argv -ref ref.dat`) set inName = (`getArgD $argv -in test.dat`) set outName = (`getArgD $argv -out shift.dat`) set refTmp = (`getArgD $argv -refTmp reftmp.dat`) set regTmp = (`getArgD $argv -regTmp regtmp.dat`) set shiftName = (`getArgD $argv -shiftName shift.txt`) set x1 = (`getArgD $argv -x1 0%`) set xn = (`getArgD $argv -xn 100%`) set sMin = (`getArgD $argv -sMin -150`) set sMax = (`getArgD $argv -sMax 150`) set sStep = (`getArgD $argv -sStep 1`) set delFlag = 0 if (`flagLoc $argv -del`) then set delFlag = 1 endif if (`flagLoc $argv -nodel`) then set delFlag = 0 endif foreach i ($refTmp $regTmp $shiftName) if (-e $i) then /bin/rm -f $i endif end if (!(-e $refName) || !(-e $inName)) then echo "Error Finding Alignment Input:" exit 1 endif readROI -ndim 1 -x X_AXIS $x1 $xn -out $refTmp -in $refName -noverb -silent -ov readROI -ndim 1 -x X_AXIS $x1 $xn -out $regTmp -in $inName -noverb -silent -ov modelXY -noverb -silent \ -data $refTmp -aData $regTmp \ -macro $NMRTXT/vvScaleShift1D.M -p 1.0 -gc 1 \ -var sMin $sMin sMax $sMax sStep $sStep >& $shiftName set shiftInfo = (`cat $shiftName`) echo " Ref: $refName Align: $inName Shift: $shiftInfo" if (`string same $inName $outName`) then nmrPipe -in $inName -out $outName -inPlace -ov -fn CS -ls $shiftInfo[2] else nmrPipe -in $inName -out $outName -ov -fn CS -ls $shiftInfo[2] endif if ($delFlag != 0) then foreach i ($refTmp $regTmp) if (-e $i) then /bin/rm -f $i endif end endif