예제 #1
0
    def __init__(self):
        super(CompressorMap, self).__init__()

        self.add_input('Nc', val=1.0)
        self.add_input('Rline', val=2.0)
        self.add_input('alpha', val=0.0)

        self.add_output('PR', val=1.0, surrogate=NearestNeighbor(interpolant_type='linear'))
        self.add_output('eff', val=1.0, surrogate=NearestNeighbor(interpolant_type='linear'))
        self.add_output('Wc', val=1.0, surrogate=NearestNeighbor(interpolant_type='linear'))
예제 #2
0
 def setup(self):
     surrogate = NearestNeighbor()
     self.add_output('sin_x',
                     0.,
                     surrogate=surrogate,
                     training_data=.5 *
                     np.sin(np.linspace(0, 10, 20)))
 def setUp(self):
     self.surrogate = NearestNeighbor(interpolant_type='linear')
     self.x = np.array([[0., 0.], [2., 0.], [2., 2.], [0., 2.], [1., 1.]])
     self.y = np.array([[1., 0., .5, 1.], [1., 0., .5,
                                           1.], [1., 0., .5, 1.],
                        [1., 0., .5, 1.], [0., 1., .5, 0.]])
     self.surrogate.train(self.x, self.y)
예제 #4
0
    def test_unrecognized_type(self):
        with self.assertRaises(ValueError) as cm:
            NearestNeighbor(interpolant_type='junk')

        expected_msg = "NearestNeighbor: Value ('junk') of option 'interpolant_type' is not one of " \
                       "['linear', 'weighted', 'rbf']."
        self.assertEqual(expected_msg, str(cm.exception))
    def test_unrecognized_type(self):
        with self.assertRaises(ValueError) as cm:
            NearestNeighbor(interpolant_type='junk')

        expected_msg = "NearestNeighbor: interpolant_type 'junk' not supported." \
                       " interpolant_type must be one of ['linear', 'weighted'," \
                       " 'rbf']."

        self.assertEqual(expected_msg, str(cm.exception))
예제 #6
0
    def __init__(self):
        super(CompressorMap, self).__init__()

        compmap = self.add('compmap', MetaModel())

        compmap.add_param('Nc', val=1.0)
        compmap.add_param('Rline', val=2.0)
        compmap.add_param('alpha', val=0.0)

        compmap.add_output(
            'PR',
            val=1.0,
            surrogate=NearestNeighbor(interpolant_type='linear'))
        compmap.add_output(
            'eff',
            val=1.0,
            surrogate=NearestNeighbor(interpolant_type='linear'))
        compmap.add_output(
            'Wc',
            val=1.0,
            surrogate=NearestNeighbor(interpolant_type='linear'))
 def setUp(self):
     self.surrogate = NearestNeighbor(interpolant_type='rbf',
                                      num_neighbors=4)
     self.x = np.array([[0.], [1.], [2.], [3.]])
     self.y = np.array([[0.], [2.], [2.], [0.]])
     self.surrogate.train(self.x, self.y)