added option to use pixel weighted chi2