Cleaned up pwmtest.py and added documentation