calculates chisq only for active components
added tests for inactive component bug
Automatic style corrections courtesy of autopep8
Merge pull request #293 from to266/chi_squared

Chi squared bugfix