Example #1
0
    def test_calculate_avg_skewness(self):
        """
        Test :meth:`bet.sensitivity.chooseQoIs.calculate_avg_skewness`.
        """
        self.qoi_set = range(0, self.input_dim)
        (self.skewness, self.skewnessgi) = cQoIs.calculate_avg_skewness(\
            self.input_set_centers, self.qoi_set)

        # Check that skewness and skewnessgi are the right size
        self.assertEqual(isinstance(self.skewness, float), True)
        self.assertEqual(self.skewnessgi.shape, (self.num_centers,
            self.input_dim))

        # Test the method returns an error when more qois are given than
        # parameters
        self.input_set_centers.set_jacobians(np.random.uniform(-1, 1, [10, 4, 3]))
        with self.assertRaises(ValueError):
            cQoIs.calculate_avg_measure(self.input_set_centers)
Example #2
0
    def test_calculate_avg_skewness(self):
        """
        Test :meth:`bet.sensitivity.chooseQoIs.calculate_avg_skewness`.
        """
        self.qoi_set = range(0, self.input_dim)
        (self.skewness, self.skewnessgi) = cQoIs.calculate_avg_skewness(\
            self.input_set_centers, self.qoi_set)

        # Check that skewness and skewnessgi are the right size
        self.assertEqual(isinstance(self.skewness, float), True)
        self.assertEqual(self.skewnessgi.shape,
                         (self.num_centers, self.input_dim))

        # Test the method returns an error when more qois are given than
        # parameters
        self.input_set_centers.set_jacobians(
            np.random.uniform(-1, 1, [10, 4, 3]))
        with self.assertRaises(ValueError):
            cQoIs.calculate_avg_measure(self.input_set_centers)
Example #3
0
    def test_calculate_avg_condnum(self):
        """
        Test :meth:`bet.sensitivity.chooseQoIs.calculate_avg_condnum`.
        """
        self.qoi_set = range(0, self.input_dim)
        print self.input_set_centers.get_jacobians()
        print self.center_disc._input_sample_set.get_jacobians()
        (self.condnum, self.singvals) = cQoIs.calculate_avg_condnum(\
            self.input_set_centers, self.qoi_set)

        # Check that condnum and singvals are the right size
        self.assertEqual(isinstance(self.condnum, float), True)
        self.assertEqual(self.singvals.shape, (self.num_centers,
            self.input_dim))

        # Test the method returns an error when more qois are given than
        # parameters
        self.input_set_centers.set_jacobians(np.random.uniform(-1, 1, [10, 4, 3]))
        with self.assertRaises(ValueError):
            cQoIs.calculate_avg_measure(self.input_set_centers)
Example #4
0
    def test_calculate_avg_condnum(self):
        """
        Test :meth:`bet.sensitivity.chooseQoIs.calculate_avg_condnum`.
        """
        self.qoi_set = range(0, self.input_dim)
        print self.input_set_centers.get_jacobians()
        print self.center_disc._input_sample_set.get_jacobians()
        (self.condnum, self.singvals) = cQoIs.calculate_avg_condnum(\
            self.input_set_centers, self.qoi_set)

        # Check that condnum and singvals are the right size
        self.assertEqual(isinstance(self.condnum, float), True)
        self.assertEqual(self.singvals.shape,
                         (self.num_centers, self.input_dim))

        # Test the method returns an error when more qois are given than
        # parameters
        self.input_set_centers.set_jacobians(
            np.random.uniform(-1, 1, [10, 4, 3]))
        with self.assertRaises(ValueError):
            cQoIs.calculate_avg_measure(self.input_set_centers)