pNNx - Time Domain Heart Rate Variability Analysis 1.0.0

File: <base>/pNNx.src/pNNx (1,341 bytes)
#! /bin/sh
# file: pnnx
#
# Calculate pNNx for a given record and annotator, using ann2rr and pnnlist

PNNOPT=""

while [ $# -gt 0 ]
do
  case $1 in
    -a) ANNOTATOR=$2; shift ;;
    -f) START=$2; shift ;;
    -h) echo "usage: pNNx -r RECORD -a ANNOTATOR [ OPTIONS ... ]"
	echo " where RECORD and ANNOTATOR specify the input, and OPTIONS may include:"
	echo " -f TIME   start at the specified TIME"
        echo " -h        print (this) usage summary"
        echo " -i INC    calculate pNNx at specified increments (0, INC, 2*INC, ...)"
        echo " -p        calculate ppNNx (percent pNNx)"
        echo " -s        calculate psNNx (signed pNNx)"
	echo " -t TIME   stop at the specified TIME"
        exit 0 ;;
    -i) PNNOPT="$PNNOPT -i $2"; shift ;;
    -p) PNNOPT="$PNNOPT -p" ;;
    -r) RECORD=$2; shift ;;
    -s) PNNOPT="$PNNOPT -s" ;;
    -t) END=$2; shift ;; 
  esac
  shift
done

echo -n >/tmp/echo.$$
if [ -s echo.$$ ]
then
   P1=""
   P2="\\c"
else
   P1="-n"
   P2=""
fi
rm -f /tmp/echo.$$

if [ x$RECORD = x ]; then
  echo $P1 "Enter the record name: " $P2
  read RECORD
fi

if [ x$ANNOTATOR = x ]; then
  echo $P1 "Enter the annotator name: " $P2
  read ANNOTATOR
fi

if [ x$START = x ]; then
  START=0
fi

if [ x$END = x ]; then
  END=e
fi

ann2rr -r $RECORD -a $ANNOTATOR -f $START -t $END -A -i s8 -w | pnnlist $PNNOPT