def test_fit_profile_simple_b(self): _fit_with_constraint = IndexedFit(self._data_container, model_function=self._model) _fit_with_constraint.add_parameter_constraint('b', self._means[1], np.sqrt(self._vars[1])) self._test_consistency(_fit_with_constraint, self._cov_mat_simple_b_inv)
def test_fit_profile_cov_mat_uncorrelated(self): _fit_with_constraint = IndexedFit(self._data_container, model_function=self._model) _fit_with_constraint.add_matrix_parameter_constraint(['a', 'b'], self._means, self._cov_mat_uncor) self._test_consistency(_fit_with_constraint, self._cov_mat_uncor_inv) _fit_with_constraint_alt = IndexedFit(self._data_container, model_function=self._model) _fit_with_constraint_alt.add_parameter_constraint('a', self._means[0], np.sqrt(self._vars[0])) _fit_with_constraint_alt.add_parameter_constraint('b', self._means[1], np.sqrt(self._vars[1])) self._test_consistency(_fit_with_constraint_alt, self._cov_mat_uncor_inv)
def test_bad_input_exception(self): _fit_with_constraint = IndexedFit(self._data_container, model_function=self._model) with self.assertRaises(IndexedFitException): _fit_with_constraint.add_parameter_constraint('c', 1.0, 1.0) with self.assertRaises(IndexedFitException): _fit_with_constraint.add_matrix_parameter_constraint(['a', 'c'], [1.0, 2.0], [[0.2, 0.0], [0.0, 0.1]]) with self.assertRaises(IndexedFitException): _fit_with_constraint.add_matrix_parameter_constraint(['a'], [1.0, 2.0], [[0.2, 0.0], [0.0, 0.1]])