replace analysis.py with upstream version

replace analysis.py w/ upstream version.