Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1077 from hschilling/P168758070-show-xy-values
P168758070 Show x/y values for scatter plot training points
- Loading branch information
Showing
4 changed files
with
95 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
openmdao/visualization/meta_model_viewer/tests/multiple_metamodels.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import numpy as np | ||
import openmdao.api as om | ||
|
||
|
||
class CosMetaModel(om.MetaModelUnStructuredComp): | ||
def setup(self): | ||
# Training Data | ||
x_train = np.linspace(0, 10, 20) | ||
y_train = np.linspace(0, 20, 20) | ||
|
||
# Inputs | ||
self.add_input('x', 0., training_data=x_train) | ||
self.add_input('y', 0., training_data=y_train) | ||
|
||
# Outputs | ||
self.add_output('cos_x', 0., training_data=np.cos(x_train + y_train)) | ||
|
||
# Surrogate Model | ||
self.options['default_surrogate'] = om.ResponseSurface() | ||
|
||
|
||
class SinMetaModel(om.MetaModelUnStructuredComp): | ||
def setup(self): | ||
# Training Data | ||
x_train = np.linspace(0, 10, 20) | ||
y_train = np.linspace(0, 20, 20) | ||
|
||
# Inputs | ||
self.add_input('x', 0., training_data=x_train) | ||
self.add_input('y', 0., training_data=y_train) | ||
|
||
# Outputs | ||
self.add_output('sin_x', 0., training_data=np.sin(x_train + y_train)) | ||
|
||
# Surrogate Model | ||
self.options['default_surrogate'] = om.ResponseSurface() | ||
|
||
|
||
# define model with two metamodel components | ||
model = om.Group() | ||
cos_mm = model.add_subsystem('cos_mm', CosMetaModel()) | ||
sin_mm = model.add_subsystem('sin_mm', SinMetaModel()) | ||
|
||
# setup a problem using our dual metamodel model | ||
prob = om.Problem(model) | ||
prob.setup() | ||
prob.final_setup() | ||
|