def test_training_gradient_akima_basic(self):
    model = om.Group()
    ivc = om.IndepVarComp()
    mapdata = SampleMap()
    params = mapdata.param_data
    outs = mapdata.output_data
    ivc.add_output('x', np.array([0.33]))
    ivc.add_output('f_train', np.array([0.3, 0.7, 0.5, 0.6, 0.3, 0.4, 0.2]))
    comp = om.MetaModelStructuredComp(training_data_gradients=True, method='akima', vec_size=1)
    comp.add_input('x', 0.0, np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7]))
    comp.add_output('f', 0.0, np.array([0.3, 0.7, 0.5, 0.6, 0.3, 0.4, 0.2]))
    model.add_subsystem('ivc', ivc, promotes=['*'])
    model.add_subsystem('comp', comp, promotes=['*'])
    prob = om.Problem(model)
    prob.setup(force_alloc_complex=True)
    prob.run_model()
    self.run_and_check_derivs(prob)
def test_training_gradient_akima_basic(self):
    model = om.Group()
    ivc = om.IndepVarComp()
    mapdata = SampleMap()
    params = mapdata.param_data
    outs = mapdata.output_data
    ivc.add_output('x', np.array([0.33]))
    ivc.add_output('f_train', np.array([0.3, 0.7, 0.5, 0.6, 0.3, 0.4, 0.2]))
    comp = om.MetaModelStructuredComp(training_data_gradients=True, method='akima', vec_size=1)
    comp.add_input('x', 0.0, np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7]))
    comp.add_output('f', 0.0, np.array([0.3, 0.7, 0.5, 0.6, 0.3, 0.4, 0.2]))
    model.add_subsystem('ivc', ivc, promotes=['*'])
    model.add_subsystem('comp', comp, promotes=['*'])
    prob = om.Problem(model)
    prob.setup(force_alloc_complex=True)
    prob.run_model()
    self.run_and_check_derivs(prob)