IP=${1:-192.168.165.44}  # default RFS in BEG lab

SPARTAN=""
FILE="-f live_prc_regmap.json"

# First argument, IP address, is required
echo $#
if [ $# -lt 1 ];
then
    echo 'Missing required argument: IP address'
    exit 1
fi

IP=$1
shift;
while [ $# -gt 0 ];
do
    opt=$1;
    case $opt in
	"-w" )
	    shift;
	    DATADIR=$1
	    FILE=`echo -f $DATADIR/live_prc_regmap.json`
	    echo "Will write files to $DATADIR FILE arg $FILE"
	    shift;
	    ;;
	"-u" )
	    shift;
	    SPARTAN=" -u"
	    ;;
    esac
done

python sel_gains.py $IP $FILE $SPARTAN
