get-stats.sh 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. echo "Tables:"
  13. head -74 output
  14. echo -n "Number of bridges that received more than 0 connections: "
  15. grep '^Single: ' output | grep 'max=' | wc -l
  16. echo -n "Number of bridges that received more than 8 connections: "
  17. grep '^Single: ' output | grep 'max=' | grep -v 'max=8' | wc -l
  18. echo -n "Number of bridges that received more than 16 connections: "
  19. grep '^Single: ' output | grep 'max=' | grep -v 'max=8' | grep -v 'max=16' | wc -l
  20. echo -n "Number of bridges that received more than 24 connections: "
  21. grep '^Single: ' output | grep 'max=' | grep -v 'max=8' | grep -v 'max=16' | grep -v 'max=24' | wc -l
  22. echo ""
  23. echo -n "Number of bridges with connection count mean more than 1 stddev away from 0: "
  24. grep "^Single: Zero is " output | grep -v "^Single: Zero is 0." | wc -l
  25. echo -n "Max number of stddevs from 0: "
  26. 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
  27. echo ""
  28. echo -n "Number of pairs of bridges that received more than 8 connections: "
  29. grep '^Double: ' output | grep 'max=' | grep -v 'max=8' | wc -l
  30. echo -n "Number of pairs of bridges that received more than 16 connections: "
  31. grep '^Double: ' output | grep 'max=' | grep -v 'max=8' | grep -v 'max=16' | wc -l
  32. echo -n "Number of pairs of bridges that received more than 24 connections: "
  33. grep '^Double: ' output | grep 'max=' | grep -v 'max=8' | grep -v 'max=16' | grep -v 'max=24' | wc -l
  34. echo -n "Number of pairs of bridges that received more than 32 connections: "
  35. grep '^Double: ' output | grep 'max=' | grep -v 'max=8' | grep -v 'max=16' | grep -v 'max=24' | grep -v 'max=32' | wc -l
  36. echo ""
  37. echo -n "Number of pairs of bridges with connection count mean more than 1 stddev away from 0: "
  38. grep "^Double: Zero is " output | grep -v "^Double: Zero is 0." | wc -l
  39. echo -n "Max number of stddevs from 0: "
  40. 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
  41. echo ""
  42. ./scripts/get-stats-non-obfs4-email.py