Skip to content

Commit 76c64dd

Browse files
release 0.5.1
2 parents 67ae2a1 + 8563d3c commit 76c64dd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3995
-147
lines changed

.github/workflows/ci_cd.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
fail-fast: false
5252
matrix:
5353
os: [ubuntu-latest, windows-latest, macos-latest]
54-
python-version: ['3.8', '3.9', '3.10', '3.11']
54+
python-version: ['3.9', '3.10', '3.11', '3.12']
5555
should-release:
5656
- ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
5757
exclude:
@@ -73,7 +73,7 @@ jobs:
7373
strategy:
7474
matrix:
7575
os: [ ubuntu-latest ]
76-
python-version: [ '3.8', '3.9', '3.10', '3.11' ]
76+
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
7777

7878
steps:
7979
- uses: actions/checkout@v4
@@ -120,6 +120,7 @@ jobs:
120120
with:
121121
python-version: ${{ env.MAIN_PYTHON_VERSION }}
122122
check-links: false
123+
sphinxopts: '-j auto'
123124

124125
package:
125126
name: Package library

.github/workflows/nightly-docs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
with:
2424
python-version: ${{ env.MAIN_PYTHON_VERSION }}
2525
check-links: false
26+
sphinxopts: '-j auto'
2627

2728
docs_upload:
2829
needs: docs_build

.github/workflows/nightly.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
fail-fast: false
3131
matrix:
3232
os: [ubuntu-latest, windows-latest]
33-
python-version: ['3.8', '3.9', '3.10', '3.11']
33+
python-version: [ '3.9', '3.10', '3.11', '3.12']
3434
steps:
3535
- name: Build wheelhouse and perform smoke test
3636
uses: ansys/actions/build-wheelhouse@v4
@@ -47,7 +47,7 @@ jobs:
4747
strategy:
4848
matrix:
4949
os: [ ubuntu-latest ]
50-
python-version: [ '3.8', '3.9', '3.10', '3.11' ]
50+
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
5151

5252
steps:
5353
- uses: actions/checkout@v4

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ To reach the project support team, email `[email protected] <pyansys.core@a
6666

6767
Installation
6868
------------
69-
The ``pydynamicreporting`` package supports Python 3.7 through 3.11 on
69+
The ``pydynamicreporting`` package supports Python 3.9 through 3.12 on
7070
Windows and Linux. It is currently available on the PyPi
7171
`repository <https://pypi.org/project/ansys-dynamicreporting-core/>`_.
7272

@@ -203,7 +203,7 @@ PyDynamicReporting is licensed under the MIT license.
203203

204204
PyDynamicReporting makes no commercial claim over Ansys whatsoever.
205205
This library extends the functionality of Ansys Dynamic Reporting by
206-
adding a Python interface to Ansys Dynamic Reproting without changing
206+
adding a Python interface to Ansys Dynamic Reporting without changing
207207
the core behavior or license of the original software. The use of
208208
PyDynamicReporting requires a legally licensed copy of an Ansys product
209209
that supports Ansys Dynamic Reporting.

codegen/adr_utils.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ def get_logger(logfile=None):
6060
The logger object.
6161
"""
6262
logger = logging.getLogger()
63-
logger.setLevel(logging.DEBUG)
63+
logger.setLevel(logging.ERROR)
6464
if logfile is None:
6565
# Logging for Python APIs should be disabled by default
6666
ch = logging.NullHandler()
6767
elif logfile=='stdout':
6868
ch = logging.StreamHandler(sys.stdout)
6969
else:
7070
ch = logging.FileHandler(logfile)
71-
ch.setLevel(logging.DEBUG)
71+
ch.setLevel(logging.ERROR)
7272
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
7373
ch.setFormatter(formatter)
7474
logger.addHandler(ch)

codegen/all_test_prop.xml

Lines changed: 139 additions & 1 deletion
Large diffs are not rendered by default.

codegen/pyadritem.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class Item:
9595
self.item_image = None
9696
"""Image object (Image and PNG binary files)"""
9797
self.item_scene = None
98-
"""3D scene (AVZ, PLY, SCDOC, and STL files)"""
98+
"""3D scene (AVZ, PLY, SCDOC, GLB, and STL files)"""
9999
# Attributes for the table items
100100
self.table_attr = table_attr
101101
self.item_table = None

doc/.vale.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ WordTemplate = \b(?:%s)\b
2020
Packages = Google
2121

2222
# Define the Ansys vocabulary
23-
Vocab = ANSYS
23+
Vocab = ANSYS, Polyflow
2424

2525
[*.{md,rst}]
2626

doc/source/_static/bar_plot.png

8.89 KB
Loading

doc/source/_static/heatmap.png

8.83 KB
Loading

doc/source/_static/line_plot.png

20.6 KB
Loading

doc/source/_static/parallel_coord.png

27.8 KB
Loading

doc/source/_static/pie_plot.png

12.7 KB
Loading

doc/source/_static/sankey.png

5.94 KB
Loading

doc/source/_static/simpletable.png

7.84 KB
Loading

doc/source/class_documentation.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ API reference
33
*************
44

55
Ansys Dynamic Reporting contains a low-level API that allows the user to access
6-
a;; the available features and properties in full detail. While this low-level
6+
all the available features and properties in full detail. While this low-level
77
API is very powerful, it can also be quite complex to use and it requires a
88
steep learning curve. For a comprehensive description of this API, see
9-
`External Python API <https://nexusdemo.ensight.com/docs/html/Nexus.html?ExternalPythonAPI.html>`_
10-
in the documentation for Ansys Dynamic Reporting.
9+
the section :ref:`Low Level Python API <lowlevel>`.
1110

1211
The goal of PyDynamicReporting is to provide an easier, more Pythonic way to
1312
start or connect to an Ansys Dynamic Reporting service so that you do not need
@@ -30,9 +29,14 @@ class to create, query, and modify items.
3029
Lastly, you create and use ``Report`` instances to access reports in Ansys
3130
Dynamic Reporting.
3231

32+
3333
.. autosummary::
3434
:toctree: _autosummary/
3535

3636
ansys.dynamicreporting.core.Item
3737
ansys.dynamicreporting.core.Service
3838
ansys.dynamicreporting.core.Report
39+
40+
.. toctree::
41+
lowlevelapi/index.rst
42+

doc/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474

7575
# Intersphinx mapping
7676
intersphinx_mapping = {
77-
"python": ("https://docs.python.org/3", None),
77+
"python": ("https://docs.python.org/3.11", None),
7878
# kept here as an example
7979
# "scipy": ("https://docs.scipy.org/doc/scipy/reference", None),
8080
# "numpy": ("https://numpy.org/devdocs", None),
Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
"""
2+
.. _ref_plottype:
3+
4+
Plot types
5+
==========
6+
7+
This example shows how to start an Ansys Dynamic Reporting
8+
service via a Docker image and create different plot items.
9+
The example focuses on showing how to use the API to generate
10+
different plot types.
11+
12+
.. note::
13+
This example assumes that you do not have a local Ansys installation but
14+
are starting an Ansys Dynamic Reporting Service via a Docker image on
15+
a new database.
16+
17+
"""
18+
19+
###############################################################################
20+
# Start an Ansys Dynamic Reporting service
21+
# ----------------------------------------
22+
#
23+
# Start an Ansys Dynamic Reporting service via a Docker image on a new
24+
# database. The path for the database directory must be to an empty directory.
25+
26+
import numpy as np
27+
28+
import ansys.dynamicreporting.core as adr
29+
30+
db_dir = r"C:\tmp\new_database"
31+
adr_service = adr.Service(ansys_installation="docker", db_directory=db_dir)
32+
session_guid = adr_service.start(create_db=True)
33+
34+
###############################################################################
35+
# Create a simple table
36+
# ---------------------
37+
#
38+
# Let us start by creating a simple table and visualizing it. Create a table
39+
# with 5 columns and 3 rows.
40+
41+
simple_table = adr_service.create_item(obj_name="Simple Table", source="Documentation")
42+
simple_table.item_table = np.array(
43+
[[0, 1, 2, 3, 4], [0, 3, 6, 9, 12], [0, 1, 4, 9, 16]], dtype="|S20"
44+
)
45+
simple_table.labels_row = ["X", "line", "square"]
46+
47+
###############################################################################
48+
# You can use the labels_row attribute to set the row labels. Use the visualize
49+
# method on the object to see its representation. By default, it will be displayed
50+
# as a table
51+
52+
simple_table.visualize()
53+
54+
55+
###############################################################################
56+
#
57+
# .. image:: /_static/simpletable.png
58+
#
59+
# Visualize as a line plot
60+
# ------------------------
61+
#
62+
# Let us know create a new item that is the same as the previous simple table,
63+
# but this time we will set the plot attribute to line to visualize the values
64+
# as two line plots, and we will use the xaxis attribute to set which row should
65+
# be used as the X axis. We can also control the formatting and the title of the
66+
# axis separately with the *axis_format and *title attributes, as done below.
67+
# The result can be seen in the following image.
68+
69+
line_plot = adr_service.create_item(obj_name="Line Plot", source="Documentation")
70+
line_plot.item_table = np.array([[0, 1, 2, 3, 4], [0, 3, 6, 9, 12], [0, 1, 4, 9, 16]], dtype="|S20")
71+
line_plot.labels_row = ["X", "line", "square"]
72+
line_plot.plot = "line"
73+
line_plot.xaxis = "X"
74+
line_plot.yaxis_format = "floatdot0"
75+
line_plot.xaxis_format = "floatdot1"
76+
line_plot.xtitle = "x"
77+
line_plot.ytitle = "f(x)"
78+
line_plot.visualize()
79+
80+
81+
###############################################################################
82+
#
83+
# .. image:: /_static/line_plot.png
84+
#
85+
# Visualize as a bar plot
86+
# -----------------------
87+
#
88+
# Next, we will see how to create a bar plot, and decorate it with the same
89+
# attributes used in the previous code snippet. See the following image for
90+
# the resulting visualization.
91+
92+
bar_plot = adr_service.create_item(obj_name="Bar Plot", source="Documentation")
93+
bar_plot.item_table = np.array([[0, 1, 2, 3, 4], [0.3, 0.5, 0.7, 0.6, 0.3]], dtype="|S20")
94+
bar_plot.plot = "bar"
95+
bar_plot.labels_row = ["ics", "my variable"]
96+
bar_plot.xaxis_format = "floatdot0"
97+
bar_plot.yaxis_format = "floatdot2"
98+
bar_plot.xaxis = "ics"
99+
bar_plot.yaxis = "my variable"
100+
bar_plot.visualize()
101+
102+
103+
###############################################################################
104+
#
105+
# .. image:: /_static/bar_plot.png
106+
#
107+
# Visualize a pie chart
108+
# ---------------------
109+
#
110+
# Next supported plot type is the pie chart. Please see the following code snippet
111+
# to generate the pie chart as in the following image.
112+
113+
114+
pie_plot = adr_service.create_item(obj_name="Pie Plot", source="Documentation")
115+
pie_plot.item_table = np.array([[10, 20, 50, 20]], dtype="|S20")
116+
pie_plot.plot = "pie"
117+
pie_plot.labels_column = ["Bar", "Triangle", "Quad", "Penta"]
118+
pie_plot.visualize()
119+
120+
121+
###############################################################################
122+
#
123+
# .. image:: /_static/pie_plot.png
124+
#
125+
# Visualize a heatmap
126+
# -------------------
127+
#
128+
# Heatmaps are plots where at each (X,Y) position is associated the value of a
129+
# variable, colored according to a legend. Here the snippet on how to create
130+
# a heatmap representation - please note how nan values are also supported,
131+
# resulting in empty cells.
132+
133+
heatmap = adr_service.create_item(obj_name="Heatmap", source="Documentation")
134+
heatmap.item_table = np.array(
135+
[
136+
[0.00291, 0.01306, 0.02153, 0.01306, 0.00291],
137+
[0.01306, 0.05854, 0.09653, 0.05854, 0.01306],
138+
[0.02153, 0.09653, np.nan, 0.09653, 0.02153],
139+
[0.01306, 0.05854, 0.09653, 0.05854, 0.01306],
140+
[0.00291, 0.01306, 0.02153, 0.01306, 0.00291],
141+
],
142+
dtype="|S20",
143+
)
144+
heatmap.plot = "heatmap"
145+
heatmap.format = "floatdot0"
146+
heatmap.visualize()
147+
148+
149+
###############################################################################
150+
#
151+
# .. image:: /_static/heatmap.png
152+
#
153+
# Visualize a parallel coordinate plot
154+
# ------------------------------------
155+
#
156+
# Parallel coordinate plots are especially useful when analyzing data coming
157+
# from multiple runs. Place in each raw the values of variables for a given
158+
# simulation. Each column is a different variable. The parallel coordinate
159+
# plot allows you to visualize all this data in a way that stresses
160+
# correlations between variables and runs.
161+
162+
parallel = adr_service.create_item()
163+
parallel.item_table = np.array(
164+
[
165+
[54.2, 12.3, 1.45e5],
166+
[72.3, 9.3, 4.34e5],
167+
[45.4, 10.8, 8.45e4],
168+
[67.4, 12.2, 2.56e5],
169+
[44.8, 13.5, 9.87e4],
170+
],
171+
dtype="|S20",
172+
)
173+
parallel.labels_column = ["Temperature", "Max. Pressure", "Max. Work"]
174+
parallel.plot = "parallel"
175+
parallel.visualize()
176+
177+
178+
###############################################################################
179+
#
180+
# .. image:: /_static/parallel_coord.png
181+
#
182+
# Visualize a Sankey diagram
183+
# --------------------------
184+
#
185+
# A Sankey diagram allows you to visualize the relationship between
186+
# different elements. For this reprenstation, place the information
187+
# inside a squared table.
188+
189+
sankey_plot = adr_service.create_item()
190+
sankey_plot.item_table = np.array(
191+
[
192+
[0, 0, 8, 2, 0, 0],
193+
[0, 0, 0, 4, 0, 0],
194+
[0, 0, 0, 0, 8, 0],
195+
[0, 0, 0, 0, 5, 1],
196+
[0, 0, 0, 0, 0, 0],
197+
[0, 0, 0, 0, 0, 0],
198+
],
199+
dtype="|S20",
200+
)
201+
sankey_plot.labels_row = ["A", "B", "C", "D", "E", "F"]
202+
sankey_plot.labels_column = ["A", "B", "C", "D", "E", "F"]
203+
sankey_plot.plot = "sankey"
204+
sankey_plot.visualize()
205+
206+
207+
###############################################################################
208+
#
209+
# .. image:: /_static/sankey.png
210+
#
211+
# Close the service
212+
# -----------------
213+
#
214+
# Close the Ansys Dynamic Reporting service. The database with the items that
215+
# were created remains on disk.
216+
217+
# sphinx_gallery_thumbnail_path = '_static/01_connect_3.png'
218+
adr_service.stop()

0 commit comments

Comments
 (0)