get-stats.sh 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/sh
  2. # If the blockages have not already been evaluted, do that now
  3. if [ ! -f data/blocked_loesing ]; 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. while pdflatex appendix-a-results.tex && grep -q "Rerun to get" appendix-a-results.log; do true; done > /dev/null
  13. echo -n "Number of bridges that received more than 0 connections: "
  14. grep '^Single: ' output | grep 'max=' | wc -l
  15. echo -n "Number of bridges that received more than 8 connections: "
  16. grep '^Single: ' output | grep 'max=' | grep -v 'max=8' | wc -l
  17. echo -n "Number of bridges that received more than 16 connections: "
  18. grep '^Single: ' output | grep 'max=' | grep -v 'max=8' | grep -v 'max=16' | wc -l
  19. echo -n "Number of bridges that received more than 24 connections: "
  20. grep '^Single: ' output | grep 'max=' | grep -v 'max=8' | grep -v 'max=16' | grep -v 'max=24' | wc -l
  21. echo ""
  22. echo -n "Number of bridges with connection count mean more than 1 stddev away from 0: "
  23. grep "^Single: Zero is " output | grep -v "^Single: Zero is 0." | wc -l
  24. echo -n "Max number of stddevs from 0: "
  25. 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
  26. echo ""
  27. echo -n "Number of pairs of bridges that received more than 8 connections: "
  28. grep '^Double: ' output | grep 'max=' | grep -v 'max=8' | wc -l
  29. echo -n "Number of pairs of bridges that received more than 16 connections: "
  30. grep '^Double: ' output | grep 'max=' | grep -v 'max=8' | grep -v 'max=16' | wc -l
  31. echo -n "Number of pairs of bridges that received more than 24 connections: "
  32. grep '^Double: ' output | grep 'max=' | grep -v 'max=8' | grep -v 'max=16' | grep -v 'max=24' | wc -l
  33. echo -n "Number of pairs of bridges that received more than 32 connections: "
  34. grep '^Double: ' output | grep 'max=' | grep -v 'max=8' | grep -v 'max=16' | grep -v 'max=24' | grep -v 'max=32' | wc -l
  35. echo ""
  36. echo -n "Number of pairs of bridges with connection count mean more than 1 stddev away from 0: "
  37. grep "^Double: Zero is " output | grep -v "^Double: Zero is 0." | wc -l
  38. echo -n "Max number of stddevs from 0: "
  39. 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
  40. echo ""
  41. ./scripts/get-stats-non-obfs4-email.py
  42. echo ""
  43. echo "See appendix-a-results.pdf for a recreation of Table 1."