rename draw.py to pic.py and add generate.py
refactor spn.py and add error logging