-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#15 add plot contours request (generation_scatter)
- Loading branch information
1 parent
7085125
commit af8ace4
Showing
9 changed files
with
146 additions
and
10 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
2 changes: 1 addition & 1 deletion
2
src/aixd_grasshopper/components/aixd_PlotContours/metadata.json
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
26 changes: 26 additions & 0 deletions
26
src/aixd_grasshopper/components/aixd_PlotContoursRequest/code.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,26 @@ | ||
# flake8: noqa | ||
from scriptcontext import sticky as st | ||
from aixd_grasshopper.gh_ui import plot_contours_request | ||
from aixd_grasshopper.gh_ui import get_dataobject_types | ||
from aixd_grasshopper.gh_ui_helper import session_id | ||
from aixd_grasshopper.gh_ui_helper import component_id | ||
from aixd_grasshopper.gh_ui_helper import convert_str_to_bitmap | ||
from aixd_grasshopper.gh_ui_helper import reformat_request | ||
|
||
|
||
cid = component_id(session_id, ghenv.Component, "create_dataset_object") | ||
|
||
n_samples = 3 | ||
|
||
if plot: | ||
variable_types = get_dataobject_types(session_id())["dataobject_types"] | ||
request_dict = reformat_request(request, variable_types) | ||
print request_dict | ||
st[cid] = plot_contours_request(session_id(), request_dict, n_samples, output_type) # if output_type interactive: will launch the plotly fig in browser | ||
|
||
if cid in st.keys(): | ||
print st[cid] | ||
#TODO: add error msg here | ||
if output_type == "static" and 'imgstr' in st[cid].keys(): | ||
imgstr = st[cid]['imgstr'] | ||
img = convert_str_to_bitmap(imgstr, scale) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions
44
src/aixd_grasshopper/components/aixd_PlotContoursRequest/metadata.json
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,44 @@ | ||
{ | ||
"name": "PlotContoursRequest", | ||
"nickname": "PlotContReq", | ||
"category": "AIXD", | ||
"subcategory": "5 Plotter", | ||
"description": "Plots the requested and predicted values against the distribution contours for each pair of the corresponding variables.", | ||
"exposure": 2, | ||
"ghpython": { | ||
"isAdvancedMode": false, | ||
"iconDisplay": 0, | ||
"inputParameters": [ | ||
{ | ||
"name": "request", | ||
"description": "List of requested values, each formatted as a string with the following format: 'variable_name:value'.", | ||
"typeHintID": "str", | ||
"scriptParamAccess": 1 | ||
}, | ||
{ | ||
"name": "output_type", | ||
"description": "Plot type: 'static' creates a bitmap image, 'interactive' launches an interactive plot in a browser.", | ||
"typeHintID": "str", | ||
"scriptParamAccess": 0 | ||
}, | ||
{ | ||
"name": "plot", | ||
"description": "Set to True to (re-)create the plot.", | ||
"typeHintID": "bool", | ||
"scriptParamAccess": 0 | ||
}, | ||
{ | ||
"name": "scale", | ||
"description": "Resize factor for the static plot.", | ||
"typeHintID": "float", | ||
"scriptParamAccess": 0 | ||
} | ||
], | ||
"outputParameters": [ | ||
{ | ||
"name": "img", | ||
"description": "Bitmap image if output_type is 'static', otherwise None." | ||
} | ||
] | ||
} | ||
} |
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