Update analyze_frequencies.py

All finished. Gonna run it and see if any problems.