From d3c26cb474230fd169e5e05a34eb90175f222bbd Mon Sep 17 00:00:00 2001 From: Phillip C <162604096+phchen95@users.noreply.github.com> Date: Mon, 25 Nov 2024 20:27:42 -0500 Subject: [PATCH] Add 3d scatter & surface properties (#191) --- codegen/all_test_prop.xml | 2 +- tests/test_item.py | 57 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/codegen/all_test_prop.xml b/codegen/all_test_prop.xml index 90455c32..ec99750e 100755 --- a/codegen/all_test_prop.xml +++ b/codegen/all_test_prop.xml @@ -1 +1 @@ -Animation0=none 1=controls 2=autoplay 3=controlsautoplayMaximum video width in pixels0=as movie default 1=as imageTablescientific sigfigsX floatdotX str date_XYformat for column labels scientific sigfigsX floatdotX str date_XYcolumn A column Bformat for row labels scientific sigfigsX floatdotX str date_XYrow 1 row 2table bar line pie heatmap parallel sankey#rrggbb #rgb @rownamenumber hexadecimal digits: #8b783fcircle square cross x triangle star diamond hash plus times open dotValue={{vx}} Position={{vy}}Should the row name be appended to the marker text: 0|1|undefinedThe marker size in pointsThe opacity of the line marker. Default: 1.0Apply a linear transform to marker sizes M B = MxB. Example: 1. 0.Scalar value or name of a row with size of error bars in Y axis units. May be a list.Scalar value or name of a row accessible to line_marker_text as vaux0. May be a list.Scalar value or name of a row accessible to line_marker_text as vaux1. May be a list.Scalar value or name of a row accessible to line_marker_text as vaux2. May be a list.Scalar value or name of a row accessible to line_marker_text as vaux3. May be a list.Scalar value or name of a row accessible to line_marker_text as vaux4. May be a list.Scalar value or name of a row accessible to line_marker_text as vaux5. May be a list.Scalar value or name of a row accessible to line_marker_text as vaux6. May be a list.Scalar value or name of a row accessible to line_marker_text as vaux7. May be a list.Scalar value or name of a row accessible to line_marker_text as vaux8. May be a list.Scalar value or name of a row accessible to line_marker_text as vaux9. May be a list.Scalar value or array of values used as column category minimums.Scalar value or array of values used as column category maximums.none solid dot dash longdash dashdot longdashdotThe line width in pixels1=stack the bar charts This is a deprecated property please use bar_mode instead.group=separate the barsbins stack=stack the barsbins overlay=overlay the barbinsThe row numbersnames to use as the X axis values. Example: 2 DistanceThe row numbersnames to use as the Y axis values. Example: 0 PressureThe name of the color palette to use with line_color row data. =invert. Example: HotPosition the colorbar center relative to plot bounds 0 1. Example on left: 0.2 0.5Minimum and maximum line_color values mapped to palette extremes. Example: 0 100Showhide the colorbar with the values 10. Example: 1String draw to the right of the colorbar as a title. Default: noneThe threshold for data table columns to render as histogram. Default: 50Set to 1 to cumulate the histograms. Default: 0Set to 1 to normalize the histograms. Default: 0The bin size of the histogram. Accepts positive integer or float typesThe bar gap of the bar chart float type. Range: 0 1Chart width in pixelsChart height in pixelsSet to 0 to hide the legend. Default: 1Position the legend relative to plot bounds 0 1. Example on right: 1.2 0.5Set to 1 to display a border around the legend. Default: 0Set to 1 to show the plot border. Default: 0Adjust plot margin sizes in pixels: left top right bottom Example: default default 5 defaultThe title of the plotlinear loglinear logThe range for the x axis. Example: 0. 10.The range for the y axis. Example: 0. 10.Format for the x axis tick labels. Example: floatdot2Format for the y axis tick labels. Example: floatdot2A title for the x axisA title for the y axisleft center or right. By default there will be no justification.The string to be displayed for a NaN value. Default: NaNAllow column sorting from headers: none all data Default: allThe title of the tableAlignment of data values in each column left right center justifyVisibility of table value search field. Default: 0Number of rows visible per page. Default: 0 allOptions for the number of rows per page menu. Default: 10 25 50 100 1Control visibility of horizontal scrollbar. Default: 1Control visibility and height of vertical scrollbar. Height in points Default: 0Control visibility of table borders. Default: 1Control compactness of table. Default: 0Control wrapping of content to the next line inside a table cell. Default: 0Enabledisable default column labels. Default: 1Specify conditional formatting rules for table cell formatting.ImageImage height in pixels1=open in current page 2=open in new tab 3=image item detailsImage width in pixelsScene3D rendering panel height in pixels3D rendering panel width in pixelsFor AVZ scene views enable exploded view with the value 1. Default: 0Vector to be added to geometry coordinates. For example: 0.0 1.0 0.1Scaling factor to be applied to GLB geometry coordinates. Default: 1.0Enable VR: disable enable ifavailable. Default: disableSliderImage height in pixelsImage width in pixels1=open in current page 2=open in new tab 3=image item detailsString macro displayed under imageA list of the initial values for each sliderNone=hide nodes 1=show nodes list. Example: none 11=Show value column 0=Hide value column. Default: 1Slider caption justification: center left right justify. Default is leftA list of the caption strings macros for each sliderWidth of the slider caption column in percent. Default is 30. 0 removes the column.Select the type of item to display: image scene anim. The default is imageIf 1 scene camera changes will be shared between views and animations will be synchronized if autoplay has been selected. The default is 01=Show image controls like pan zoom etc. when image comparison is enabled. 0=Hide image controls. Default: 01=Show copy of image with sliders for comparison. 0=Disable comparison. Default: 01=Enable deep image display. 0=Disable deep image display. Note: image_comparison must also be enabled. Default: 01=Enable RGB differences. 0=Disable. Note: image_comparison must also be enabled. Default: 0A list of tag values that should be used for the common sliders when image comparison is enabled. Example: timestep variableWidth of the common slider caption column in percent. Default is 20. 0 removes the column.Common slider caption justification: center left right justify. Default is leftA list of initial values for each slider for each section in an image comparison layout. Eg: 3.8 PRESSURE_Relative 1.4 PRESSURE_RelativeList of initial values to define the palette preset which is applied after the image has loaded. One list for each section in a deep image comparison layout. Must be of the form: max min palette invert hide bg ..section 2 here... max and min must be numbers floatint. palette name must match exactly. invert and hide must be true or false. bg must be any value between 0 and 1. Eg: 30 30 autumn false true 0.4 50 50 autumn false true 0.7List of initial values to use as presets for the variable dropdown in each section of a deep image comparison layout. Variable names must match exactly and are case sensitive. Eg: PRESSURE_Relative PRESSURE_RelativeList of initial values to use as presets for the view dropdown in each section of a deep image comparison layout. Allowed values are this thisother otherthis abs. For example for the left image these would correspond to Left LeftRight image RightLeft image AbsRightLeft image respectively. Names must match exactly and are case sensitive. Eg: thisother thisSelect a tag to manipulate via X axis click and dragNumber of cycles through the tag images for a image width drag. Default: 1.0Clamp the images to the minmax instead of wrapping during a drag. Default: 0Select a tag to manipulate via Y axis click and dragNumber of cycles through the tag images for a image height drag. Default: 1.0Clamp the images to the minmax instead of wrapping during a drag. Default: 0StringString justification: center left right justify. Default is centerTreeleft center or right. By default there will be no justification.TrueFalse display values: True#Falsedate_XYscientific sigfigsX floatdotXDisplay of GUID referenced items: link inlineTree node expansion: expanded collapsedControl visibility of tree borders. Default: 1Control compactness of tree. Default: 0Set to 1 to enable global tree toggling. Default: 0Specify conditional formatting rules for tree value formatting.Table of ContentsFlag TOC items: 0=none 1=this layout 2=data itemsSet the inset level for TOC Items. Default: 0Flag figures: 0=none 1=this layout 2=data itemsFlag tables: 0=none 1=this layout 2=data itemsSet the name for the item figure table. Default: layout or item nameTemplatesApplies to justification of all items in a report. Can be left center or right. By default there will be no justification.Set to 1 to render the item as a link. Default: 0Set to 1 to enable toggling. Default: 01 sets hint not to pagebreak in the template. Default: 0Size of the left margin in points. Default: 1=layout defaultSize of the right margin in points. Default: 1=layout defaultSize of the top margin in points. Default: 1=layout defaultSize of the bottom margin in points. Default: 1=layout defaultIf 1 start the template with a line break. Set to zero to remove the line. Default: 1If set to 1 and there are fewer items than the number of columns reduce the number of columns to match the item count. Default: 00=display as tabs default 1=display tab content inline1=link replace page 2=link new page 3=button inline default 4=button inline wimageThe default is the name of the target reportIf nonzero user defined content is not displayed in PDFexported HTML. Default: 1Nonzero if the user content should appear before children. Default: 0Value of the div adr_userdefined_template attribute. Default: unspecifiedChunk size defines how many items to group together for each set of comparisonFilters table lets you define which items to compare. Each row label represents the filter name and comparison type. Each column represents an individual item you wish to query.The name of the input pptx file item or a filter query to find the item.The name to save the output pptx file as.Option to use all slides from the input pptx. Can be 1 or 0. Default is 0.The positional index of the slide in the input pptx to use as source in the output pptx.Enable or disable inclusion of the PPTX Slide Layoutslide from the table of contents. Can be 1 or 0. Default is 0.Set the title of the PPTX Slide Layoutslide only from the first available tag named pptx_slide_title among the items in the slide.Set the comments of the PPTX Slide Layoutslide only from the first available tag named pptx_slide_comments among the items in the slide.A list of types of filters to display in the left filtering pane. Eg: checkbox slider input. Allowed values are checkbox slider input dropdown single_dropdown. Default behavior uses all available tags as checkboxes.A list of tags to display as checkboxes in the left filtering pane. Eg: DesignPoint ParametricStudy dp1 dp2.A list of values to display as sliders in the left filtering pane. Can either be a tag name or a range filter plot_range_x or plot_range_y to filter across X or Y axes. Eg: IP1Velocity .A list of values to display as input boxes in the left filtering pane. Can either be a tag name or a range filter plot_range_x or plot_range_y to filter across X or Y axes. Eg: plot_range_x .A list of values to display as dropdowns in the left filtering pane. Can either be a tag name or a range filter plot_range_x or plot_range_y to filter across X or Y axes. Eg: plot_range_y.A list of tags to display as single dropdowns in the left filtering pane. Eg: dp1 dp2 DesignPoint.An integer or float value to use as stepinterval for displaying numeric tags. Default is 0.1.A string to use as label for the X axis range filter when plot_range_x is used. Default is the plots X axis title if available.A string to use as label for the Y axis range filter when plot_range_Y is used. Default is the plots Y axis title if available.The name of the input rst file item or a filter query to find the item.The name to save the output rst file as.DebuggingSet to 1 to embed item property and context information with each data item.Set to 1 to embed timing information for each template: search sort total time. \ No newline at end of file +Animation0=none 1=controls 2=autoplay 3=controlsautoplayMaximum video width in pixels0=as movie default 1=as imageTablescientific sigfigsX floatdotX str date_XYformat for column labels scientific sigfigsX floatdotX str date_XYcolumn A column Bformat for row labels scientific sigfigsX floatdotX str date_XYrow 1 row 2table bar line pie heatmap parallel sankey 3d surface#rrggbb #rgb @rownamenumber hexadecimal digits: #8b783fcircle square cross x triangle star diamond hash plus times open dotValue={{vx}} Position={{vy}}Should the row name be appended to the marker text: 0|1|undefinedThe marker size in pointsThe opacity of the line marker. Default: 1.0Apply a linear transform to marker sizes M B = Minput_sizeB. Example: 1. 0.Scalar value or name of a row with size of error bars in Y axis units. May be a list.Scalar value or name of a row accessible to line_marker_text as vaux0. May be a list.Scalar value or name of a row accessible to line_marker_text as vaux1. May be a list.Scalar value or name of a row accessible to line_marker_text as vaux2. May be a list.Scalar value or name of a row accessible to line_marker_text as vaux3. May be a list.Scalar value or name of a row accessible to line_marker_text as vaux4. May be a list.Scalar value or name of a row accessible to line_marker_text as vaux5. May be a list.Scalar value or name of a row accessible to line_marker_text as vaux6. May be a list.Scalar value or name of a row accessible to line_marker_text as vaux7. May be a list.Scalar value or name of a row accessible to line_marker_text as vaux8. May be a list.Scalar value or name of a row accessible to line_marker_text as vaux9. May be a list.Scalar value or array of values used as column category minimums.Scalar value or array of values used as column category maximums.none solid dot dash longdash dashdot longdashdotThe line width in pixels1=stack the bar charts This is a deprecated property please use bar_mode instead.group=separate the barsbins stack=stack the barsbins overlay=overlay the barbinsThe row numbersnames to use as the X axis values. Example: 2 DistanceThe row numbersnames to use as the Y axis values. Example: 0 PressureThe row numbersnames to use as the Z axis values. Example: 3 PressureThe name of the color palette to use with line_color row data. =invert. Example: HotPosition the colorbar center relative to plot bounds 0 1. Example on left: 0.2 0.5Minimum and maximum line_color values mapped to palette extremes. Example: 0 100Showhide the colorbar with the values 10. Example: 1String draw to the right of the colorbar as a title. Default: noneThe threshold for data table columns to render as histogram. Default: 50Set to 1 to cumulate the histograms. Default: 0Set to 1 to normalize the histograms. Default: 0The bin size of the histogram. Accepts positive integer or float typesThe bar gap of the bar chart float type. Range: 0 1Chart width in pixelsChart height in pixelsSet to 0 to hide the legend. Default: 1Position the legend relative to plot bounds 0 1. Example on right: 1.2 0.5Set to 1 to display a border around the legend. Default: 0Set to 1 to show the plot border. Default: 0Adjust plot margin sizes in pixels: left top right bottom Example: default default 5 defaultThe title of the plotlinear loglinear loglinear logThe range for the x axis. Example: 0. 10.The range for the y axis. Example: 0. 10.The range for the z axis. Example: 0. 10.Format for the x axis tick labels. Example: floatdot2Format for the y axis tick labels. Example: floatdot2Format for the z axis tick labels. Example: floatdot2A title for the x axisA title for the y axisA title for the z axisleft center or right. By default there will be no justification.The string to be displayed for a NaN value. Default: NaNAllow column sorting from headers: none all data Default: allThe title of the tableAlignment of data values in each column left right center justifyVisibility of table value search field. Default: 0Number of rows visible per page. Default: 0 allOptions for the number of rows per page menu. Default: 10 25 50 100 1Control visibility of horizontal scrollbar. Default: 1Control visibility and height of vertical scrollbar. Height in points Default: 0Control visibility of table borders. Default: 1Control compactness of table. Default: 0Control wrapping of content to the next line inside a table cell. Default: 0Enabledisable default column labels. Default: 1Specify conditional formatting rules for table cell formatting.ImageImage height in pixels1=open in current page 2=open in new tab 3=image item detailsImage width in pixelsScene3D rendering panel height in pixels3D rendering panel width in pixelsFor AVZ scene views enable exploded view with the value 1. Default: 0Vector to be added to geometry coordinates. For example: 0.0 1.0 0.1Scaling factor to be applied to GLB geometry coordinates. Default: 1.0Enable VR: disable enable ifavailable. Default: disableSliderImage height in pixelsImage width in pixels1=open in current page 2=open in new tab 3=image item detailsString macro displayed under imageA list of the initial values for each sliderNone=hide nodes 1=show nodes list. Example: none 11=Show value column 0=Hide value column. Default: 1Slider caption justification: center left right justify. Default is leftA list of the caption strings macros for each sliderWidth of the slider caption column in percent. Default is 30. 0 removes the column.Select the type of item to display: image scene anim. The default is imageIf 1 scene camera changes will be shared between views and animations will be synchronized if autoplay has been selected. The default is 01=Show image controls like pan zoom etc. when image comparison is enabled. 0=Hide image controls. Default: 01=Show copy of image with sliders for comparison. 0=Disable comparison. Default: 01=Enable deep image display. 0=Disable deep image display. Note: image_comparison must also be enabled. Default: 01=Enable RGB differences. 0=Disable. Note: image_comparison must also be enabled. Default: 0A list of tag values that should be used for the common sliders when image comparison is enabled. Example: timestep variableWidth of the common slider caption column in percent. Default is 20. 0 removes the column.Common slider caption justification: center left right justify. Default is leftA list of initial values for each slider for each section in an image comparison layout. Eg: 3.8 PRESSURE_Relative 1.4 PRESSURE_RelativeList of initial values to define the palette preset which is applied after the image has loaded. One list for each section in a deep image comparison layout. Must be of the form: max min palette invert hide bg ..section 2 here... max and min must be numbers floatint. palette name must match exactly. invert and hide must be true or false. bg must be any value between 0 and 1. Eg: 30 30 autumn false true 0.4 50 50 autumn false true 0.7List of initial values to use as presets for the variable dropdown in each section of a deep image comparison layout. Variable names must match exactly and are case sensitive. Eg: PRESSURE_Relative PRESSURE_RelativeList of initial values to use as presets for the view dropdown in each section of a deep image comparison layout. Allowed values are this thisother otherthis abs. For example for the left image these would correspond to Left LeftRight image RightLeft image AbsRightLeft image respectively. Names must match exactly and are case sensitive. Eg: thisother thisSelect a tag to manipulate via X axis click and dragNumber of cycles through the tag images for a image width drag. Default: 1.0Clamp the images to the minmax instead of wrapping during a drag. Default: 0Select a tag to manipulate via Y axis click and dragNumber of cycles through the tag images for a image height drag. Default: 1.0Clamp the images to the minmax instead of wrapping during a drag. Default: 0StringString justification: center left right justify. Default is centerTreeleft center or right. By default there will be no justification.TrueFalse display values: True#Falsedate_XYscientific sigfigsX floatdotXDisplay of GUID referenced items: link inlineTree node expansion: expanded collapsedControl visibility of tree borders. Default: 1Control compactness of tree. Default: 0Set to 1 to enable global tree toggling. Default: 0Specify conditional formatting rules for tree value formatting.Table of ContentsFlag TOC items: 0=none 1=this layout 2=data itemsSet the inset level for TOC Items. Default: 0Flag figures: 0=none 1=this layout 2=data itemsFlag tables: 0=none 1=this layout 2=data itemsSet the name for the item figure table. Default: layout or item nameTemplatesApplies to justification of all items in a report. Can be left center or right. By default there will be no justification.Set to 1 to render the item as a link. Default: 0Set to 1 to enable toggling. Default: 01 sets hint not to pagebreak in the template. Default: 0Size of the left margin in points. Default: 1=layout defaultSize of the right margin in points. Default: 1=layout defaultSize of the top margin in points. Default: 1=layout defaultSize of the bottom margin in points. Default: 1=layout defaultIf 1 start the template with a line break. Set to zero to remove the line. Default: 1If set to 1 and there are fewer items than the number of columns reduce the number of columns to match the item count. Default: 00=display as tabs default 1=display tab content inline1=link replace page 2=link new page 3=button inline default 4=button inline wimageThe default is the name of the target reportIf nonzero user defined content is not displayed in PDFexported HTML. Default: 1Nonzero if the user content should appear before children. Default: 0Value of the div adr_userdefined_template attribute. Default: unspecifiedChunk size defines how many items to group together for each set of comparisonFilters table lets you define which items to compare. Each row label represents the filter name and comparison type. Each column represents an individual item you wish to query.DebuggingSet to 1 to embed item property and context information with each data item.Set to 1 to embed timing information for each template: search sort total time. \ No newline at end of file diff --git a/tests/test_item.py b/tests/test_item.py index fda340d0..ba6903d5 100755 --- a/tests/test_item.py +++ b/tests/test_item.py @@ -302,6 +302,63 @@ def test_create_histo(adr_service_create) -> bool: assert len(new_table_items) == (len(table_items) + 1) +@pytest.mark.ado_test +def test_create_3d_scatter(adr_service_create) -> bool: + _ = adr_service_create.start( + create_db=True, + exit_on_close=True, + delete_db=True, + ) + filter_str = "A|i_type|cont|table" + table_items = adr_service_create.query(query_type="Item", filter=filter_str) + my_table = adr_service_create.create_item() + my_table.item_table = np.random.uniform(1.0, 50.0, size=(6, 20)) + my_table.labels_row = ["X1", "Y1", "Z1", "X2", "Y2", "Z2"] + my_table.plot = "line" + my_table.line_style = "none" + my_table.line_marker = "diamond" + my_table.xaxis = ["X1", "X2"] + my_table.yaxis = ["Y1", "Y2"] + my_table.zaxis = ["Z1", "Z2"] + my_table.zaxis_format = "floatdot0" + my_table.yaxis_format = "floatdot0" + my_table.xaxis_format = "floatdot1" + my_table.xtitle = "x" + my_table.ytitle = "f(x)" + my_table.ztitle = "f(x,y)" + my_table.line_marker_opacity = 0.7 + new_table_items = adr_service_create.query(query_type="Item", filter=filter_str) + adr_service_create.stop() + assert len(new_table_items) == (len(table_items) + 1) + + +@pytest.mark.ado_test +def test_create_3d_surface(adr_service_create) -> bool: + _ = adr_service_create.start( + create_db=True, + exit_on_close=True, + delete_db=True, + ) + filter_str = "A|i_type|cont|table" + table_items = adr_service_create.query(query_type="Item", filter=filter_str) + my_table = adr_service_create.create_item() + my_table.item_table = np.array( + [ + [0.00291, 0.01306, 0.02153, 0.01306, 0.00291], + [0.01306, 0.05854, 0.09653, 0.05854, 0.01306], + [0.02153, 0.09653, np.nan, 0.09653, 0.02153], + [0.01306, 0.05854, 0.09653, 0.05854, 0.01306], + [0.00291, 0.01306, 0.02153, 0.01306, 0.00291], + ], + dtype="|S20", + ) + my_table.plot = "3d surface" + my_table.format = "floatdot0" + new_table_items = adr_service_create.query(query_type="Item", filter=filter_str) + adr_service_create.stop() + assert len(new_table_items) == (len(table_items) + 1) + + def test_set_tags(adr_service_query) -> bool: success = False try: