Update analysis.py

rearranging function order