예제 #1
0
    def test_five_alpha_points(self):
        filename = os.path.join(self.csv_dir, 'test_five_alpha_points.csv')

        known_points_bottom = np.genfromtxt(filename,
                                            delimiter=',',
                                            usecols=(1))
        known_points_right = np.genfromtxt(filename,
                                           delimiter=',',
                                           usecols=(0))

        adjusted_points = MetaModelVisualization(self.mm)
        adjusted_points.input_point_list = [
            6.632653061224477, 3.36734693877551
        ]
        adjusted_points.dist_range = 0.5

        right_points = adjusted_points._structured_training_points(
            compute_distance=True, source='right')
        right_plot = adjusted_points._right_plot()
        right_transparency = adjusted_points.right_alphas

        bottom_points = adjusted_points._structured_training_points(
            compute_distance=True, source='bottom')
        bottom_plot = adjusted_points._bottom_plot()
        bottom_transparency = adjusted_points.bottom_alphas

        assert_almost_equal(known_points_right, right_transparency, decimal=5)
        assert_almost_equal(known_points_bottom,
                            bottom_transparency,
                            decimal=5)
예제 #2
0
    def test_single_line_of_alpha_points(self):

        adjusted_points = MetaModelVisualization(self.mm)
        adjusted_points.input_point_list = [
            6.632653061224477, 3.36734693877551
        ]

        right_points = adjusted_points._structured_training_points(
            compute_distance=True, source='right')
        right_plot = adjusted_points._right_plot()

        bottom_points = adjusted_points._structured_training_points(
            compute_distance=True, source='bottom')
        bottom_plot = adjusted_points._bottom_plot()

        self.assertTrue(len(adjusted_points.right_alphas) == 10)
        self.assertTrue(len(adjusted_points.bottom_alphas) == 10)
예제 #3
0
    def test_alpha_transparency(self):

        adjusted_points = MetaModelVisualization(self.mm)
        adjusted_points.input_point_list = [
            0.04203304, 2.043553874897959, 0.02435233
        ]
        adjusted_points.dist_range = 0.75

        known_points_right = np.array([
            0.86567989, 0.78348589, 0.639777, 0.62940986, 0.62587447,
            0.56152752, 0.50987878, 0.49376071, 0.48388914, 0.46630121,
            0.4640111, 0.45980945, 0.41160175, 0.39350227, 0.39026132,
            0.38265725, 0.38192591, 0.36878805, 0.34231505, 0.32336551,
            0.30383287, 0.29137243, 0.28730608, 0.2857517, 0.26159429,
            0.26053377, 0.22521007, 0.18561353, 0.17247835, 0.13633153,
            0.10337783, 0.10021358, 0.08660427, 0.08069668, 0.06691626,
            0.05474111, 0.04688808, 0.04670316, 0.01284643, 0.00901992,
            0.00842553, 0.00386693
        ])

        known_points_bottom = np.array([
            7.65526230e-01, 7.38928632e-01, 7.26005432e-01, 7.15400571e-01,
            6.49085815e-01, 6.40394477e-01, 6.28033520e-01, 6.13040213e-01,
            5.83063203e-01, 4.39487058e-01, 3.68150531e-01, 3.43219760e-01,
            3.23457593e-01, 2.99935268e-01, 2.52810393e-01, 2.44806774e-01,
            2.43471983e-01, 2.36658494e-01, 2.33785648e-01, 2.22517218e-01,
            2.08587699e-01, 1.99369532e-01, 1.95640614e-01, 1.80272528e-01,
            1.74355451e-01, 1.52993016e-01, 1.28729050e-01, 1.28385003e-01,
            1.28254220e-01, 1.05787985e-01, 1.01550282e-01, 8.44650788e-02,
            6.39578812e-02, 3.34477398e-02, 1.97405267e-02, 6.40957590e-04
        ])

        right_points = adjusted_points._unstructured_training_points(
            compute_distance=True, source='right')
        right_plot = adjusted_points._right_plot()
        right_transparency = adjusted_points.right_alphas

        bottom_points = adjusted_points._unstructured_training_points(
            compute_distance=True, source='bottom')
        bottom_plot = adjusted_points._bottom_plot()
        bottom_transparency = adjusted_points.bottom_alphas

        assert_rel_error(self, right_transparency, known_points_right, 1.1e-02)
        assert_rel_error(self, bottom_transparency, known_points_bottom,
                         1.6e-02)