Separate cal and IO process.
Merge pull request #71 from chao787/feature_richard

Separate cal and IO process.
follow PEP8: change tab to 4 white spaces
merge chage from chao78787