get-stats.sh 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/sh
  2. # If the blockages have not already been evaluted, do that now
  3. if [ ! -f data/blocked_0 ]; then
  4. echo "Running python code to evaluate blockages..."
  5. ./scripts/evaluate-blockages.py
  6. fi
  7. # Do the actual math in python
  8. if [ ! -f output ]; then
  9. echo "Running python code to compute stats..."
  10. ./scripts/get-stats.py > output
  11. fi
  12. echo "Tables:"
  13. head -33 output
  14. echo -n "Number of bridges that received more than 8 connections: "
  15. grep '^Single: ' output | grep 'max=' | grep -v 'max=8' | wc -l
  16. echo -n "Number of bridges that received more than 16 connections: "
  17. grep '^Single: ' output | grep 'max=' | grep -v 'max=8' | grep -v 'max=16' | wc -l
  18. echo -n "Number of bridges that received more than 24 connections: "
  19. grep '^Single: ' output | grep 'max=' | grep -v 'max=8' | grep -v 'max=16' | grep -v 'max=24' | wc -l
  20. echo ""
  21. echo -n "Number of bridges with connection count mean more than 1 stddev away from 0: "
  22. grep "^Single: Zero is " output | grep -v "^Single: Zero is 0." | wc -l
  23. echo -n "Max number of stddevs from 0: "
  24. grep "^Single: Zero is " output | grep -v "^Single: Zero is 0." | grep -Po '(?<=^Single: Zero is )(.*?)(?= standard deviations away from the mean)' | sort -r | head -1
  25. echo ""
  26. echo -n "Number of pairs of bridges that received more than 8 connections: "
  27. grep '^Double: ' output | grep 'max=' | grep -v 'max=8' | wc -l
  28. echo -n "Number of pairs of bridges that received more than 16 connections: "
  29. grep '^Double: ' output | grep 'max=' | grep -v 'max=8' | grep -v 'max=16' | wc -l
  30. echo -n "Number of pairs of bridges that received more than 24 connections: "
  31. grep '^Double: ' output | grep 'max=' | grep -v 'max=8' | grep -v 'max=16' | grep -v 'max=24' | wc -l
  32. echo -n "Number of pairs of bridges that received more than 32 connections: "
  33. grep '^Double: ' output | grep 'max=' | grep -v 'max=8' | grep -v 'max=16' | grep -v 'max=24' | grep -v 'max=32' | wc -l
  34. echo ""
  35. echo -n "Number of pairs of bridges with connection count mean more than 1 stddev away from 0: "
  36. grep "^Double: Zero is " output | grep -v "^Double: Zero is 0." | wc -l
  37. echo -n "Max number of stddevs from 0: "
  38. grep "^Double: Zero is " output | grep -v "^Double: Zero is 0." | grep -Po '(?<=^Double: Zero is )(.*?)(?= standard deviations away from the mean)' | sort -r | head -1