satnogs-wut/src/wut-compare-tx

44 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# wut-compare-tx
#
# Check the results of a prediction against vetted results
# using a selected transmitter UUID.
# Uses all files in download/ directory.
#
# Usage:
# wut-compare-tx [Transmitter UUID]
# Example:
# wut-compare-tx KgazZMKEa74VnquqXLwAvD
MAIN_DIR=`pwd`
OBSTX="$1"
cd download/ || exit
CORRECT=0
INCORRECT=0
for OBSID in *
do
cd $MAIN_DIR
# Get previous rating
VET=`cat download/$OBSID/$OBSID.json | jq --compact-output '.[0] | {vetted_status}' | cut -f 2 -d ":" | sed -e 's/}//g' -e 's/"//g'`
TX=`cat download/$OBSID/$OBSID.json | jq --compact-output '.[0] | {transmitter_uuid}' | cut -f 2 -d ":" | sed -e 's/}//g' -e 's/"//g'`
if [ "$OBSTX" = "$TX" ] ; then
echo -n "$OBSID "
echo -n "Vet: $VET "
# Get Machine Learning Result
WUT_VETS=`wut $OBSID`
WUT_VET=`echo $WUT_VETS | cut -f 2 -d " "`
WUT_RATE=`echo $WUT_VETS | cut -f 1 -d " "`
echo -n "$WUT_VET, "
echo -n "$WUT_RATE, "
if [ "$VET" = "$WUT_VET" ] ; then
let CORRECT=$CORRECT+1
else
let INCORRECT=$INCORRECT+1
fi
echo "Correct: $CORRECT Incorrect: $INCORRECT"
fi
done