Exemple #1
0
    def test_func_exp(self):
        """Unit test for the value returned by the func_exp() function at the minimum."""

        # Get the chi-squared value.
        val = func_exp(self.params)

        # Assert that the value must be 0.0.
        self.assertAlmostEqual(val, 0.0)
Exemple #2
0
    def test_func_exp(self):
        """Unit test for the value returned by the func_exp() function at the minimum."""

        # Get the chi-squared value.
        val = func_exp(self.params)

        # Assert that the value must be 0.0.
        self.assertAlmostEqual(val, 0.0)
    def func_exp(self, params):
        """Wrapper function for the C module, for converting numpy arrays.

        @param params:  The parameter array from the minimisation code.
        @type params:   numpy array
        @return:        The function value generated by the C module.
        @rtype:         float
        """

        # Convert if necessary.
        if isinstance(params, ndarray):
            params = params.tolist()

        # Call the C code.
        chi2 = func_exp(params)

        # Return the chi2 value.
        return nan_to_num(chi2)
Exemple #4
0
    def func_exp(self, params):
        """Wrapper function for the C module, for converting numpy arrays.

        @param params:  The parameter array from the minimisation code.
        @type params:   numpy array
        @return:        The function value generated by the C module.
        @rtype:         float
        """

        # Convert if necessary.
        if isinstance(params, ndarray):
            params = params.tolist()

        # Call the C code.
        chi2 = func_exp(params)

        # Return the chi2 value.
        return nan_to_num(chi2)