Skip to content

Commit

Permalink
release 0.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mariostieriansys committed Jan 18, 2024
2 parents 67ae2a1 + 8563d3c commit 76c64dd
Show file tree
Hide file tree
Showing 51 changed files with 3,995 additions and 147 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']
should-release:
- ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
exclude:
Expand All @@ -73,7 +73,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.8', '3.9', '3.10', '3.11' ]
python-version: [ '3.9', '3.10', '3.11', '3.12' ]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -120,6 +120,7 @@ jobs:
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
check-links: false
sphinxopts: '-j auto'

package:
name: Package library
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/nightly-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
check-links: false
sphinxopts: '-j auto'

docs_upload:
needs: docs_build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: [ '3.9', '3.10', '3.11', '3.12']
steps:
- name: Build wheelhouse and perform smoke test
uses: ansys/actions/build-wheelhouse@v4
Expand All @@ -47,7 +47,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.8', '3.9', '3.10', '3.11' ]
python-version: [ '3.9', '3.10', '3.11', '3.12' ]

steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ To reach the project support team, email `pyansys.core@ansys.com <pyansys.core@a

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

Expand Down Expand Up @@ -203,7 +203,7 @@ PyDynamicReporting is licensed under the MIT license.

PyDynamicReporting makes no commercial claim over Ansys whatsoever.
This library extends the functionality of Ansys Dynamic Reporting by
adding a Python interface to Ansys Dynamic Reproting without changing
adding a Python interface to Ansys Dynamic Reporting without changing
the core behavior or license of the original software. The use of
PyDynamicReporting requires a legally licensed copy of an Ansys product
that supports Ansys Dynamic Reporting.
Expand Down
4 changes: 2 additions & 2 deletions codegen/adr_utils.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ def get_logger(logfile=None):
The logger object.
"""
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
logger.setLevel(logging.ERROR)
if logfile is None:
# Logging for Python APIs should be disabled by default
ch = logging.NullHandler()
elif logfile=='stdout':
ch = logging.StreamHandler(sys.stdout)
else:
ch = logging.FileHandler(logfile)
ch.setLevel(logging.DEBUG)
ch.setLevel(logging.ERROR)
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
ch.setFormatter(formatter)
logger.addHandler(ch)
Expand Down
140 changes: 139 additions & 1 deletion codegen/all_test_prop.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion codegen/pyadritem.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class Item:
self.item_image = None
"""Image object (Image and PNG binary files)"""
self.item_scene = None
"""3D scene (AVZ, PLY, SCDOC, and STL files)"""
"""3D scene (AVZ, PLY, SCDOC, GLB, and STL files)"""
# Attributes for the table items
self.table_attr = table_attr
self.item_table = None
Expand Down
2 changes: 1 addition & 1 deletion doc/.vale.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ WordTemplate = \b(?:%s)\b
Packages = Google

# Define the Ansys vocabulary
Vocab = ANSYS
Vocab = ANSYS, Polyflow

[*.{md,rst}]

Expand Down
Binary file added doc/source/_static/bar_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/_static/heatmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/_static/line_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/_static/parallel_coord.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/_static/pie_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/_static/sankey.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/_static/simpletable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions doc/source/class_documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ API reference
*************

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

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


.. autosummary::
:toctree: _autosummary/

ansys.dynamicreporting.core.Item
ansys.dynamicreporting.core.Service
ansys.dynamicreporting.core.Report

.. toctree::
lowlevelapi/index.rst

2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

# Intersphinx mapping
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"python": ("https://docs.python.org/3.11", None),
# kept here as an example
# "scipy": ("https://docs.scipy.org/doc/scipy/reference", None),
# "numpy": ("https://numpy.org/devdocs", None),
Expand Down
218 changes: 218 additions & 0 deletions doc/source/examples_source/00-basic/02-plottype.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
"""
.. _ref_plottype:
Plot types
==========
This example shows how to start an Ansys Dynamic Reporting
service via a Docker image and create different plot items.
The example focuses on showing how to use the API to generate
different plot types.
.. note::
This example assumes that you do not have a local Ansys installation but
are starting an Ansys Dynamic Reporting Service via a Docker image on
a new database.
"""

###############################################################################
# Start an Ansys Dynamic Reporting service
# ----------------------------------------
#
# Start an Ansys Dynamic Reporting service via a Docker image on a new
# database. The path for the database directory must be to an empty directory.

import numpy as np

import ansys.dynamicreporting.core as adr

db_dir = r"C:\tmp\new_database"
adr_service = adr.Service(ansys_installation="docker", db_directory=db_dir)
session_guid = adr_service.start(create_db=True)

###############################################################################
# Create a simple table
# ---------------------
#
# Let us start by creating a simple table and visualizing it. Create a table
# with 5 columns and 3 rows.

simple_table = adr_service.create_item(obj_name="Simple Table", source="Documentation")
simple_table.item_table = np.array(
[[0, 1, 2, 3, 4], [0, 3, 6, 9, 12], [0, 1, 4, 9, 16]], dtype="|S20"
)
simple_table.labels_row = ["X", "line", "square"]

###############################################################################
# You can use the labels_row attribute to set the row labels. Use the visualize
# method on the object to see its representation. By default, it will be displayed
# as a table

simple_table.visualize()


###############################################################################
#
# .. image:: /_static/simpletable.png
#
# Visualize as a line plot
# ------------------------
#
# Let us know create a new item that is the same as the previous simple table,
# but this time we will set the plot attribute to line to visualize the values
# as two line plots, and we will use the xaxis attribute to set which row should
# be used as the X axis. We can also control the formatting and the title of the
# axis separately with the *axis_format and *title attributes, as done below.
# The result can be seen in the following image.

line_plot = adr_service.create_item(obj_name="Line Plot", source="Documentation")
line_plot.item_table = np.array([[0, 1, 2, 3, 4], [0, 3, 6, 9, 12], [0, 1, 4, 9, 16]], dtype="|S20")
line_plot.labels_row = ["X", "line", "square"]
line_plot.plot = "line"
line_plot.xaxis = "X"
line_plot.yaxis_format = "floatdot0"
line_plot.xaxis_format = "floatdot1"
line_plot.xtitle = "x"
line_plot.ytitle = "f(x)"
line_plot.visualize()


###############################################################################
#
# .. image:: /_static/line_plot.png
#
# Visualize as a bar plot
# -----------------------
#
# Next, we will see how to create a bar plot, and decorate it with the same
# attributes used in the previous code snippet. See the following image for
# the resulting visualization.

bar_plot = adr_service.create_item(obj_name="Bar Plot", source="Documentation")
bar_plot.item_table = np.array([[0, 1, 2, 3, 4], [0.3, 0.5, 0.7, 0.6, 0.3]], dtype="|S20")
bar_plot.plot = "bar"
bar_plot.labels_row = ["ics", "my variable"]
bar_plot.xaxis_format = "floatdot0"
bar_plot.yaxis_format = "floatdot2"
bar_plot.xaxis = "ics"
bar_plot.yaxis = "my variable"
bar_plot.visualize()


###############################################################################
#
# .. image:: /_static/bar_plot.png
#
# Visualize a pie chart
# ---------------------
#
# Next supported plot type is the pie chart. Please see the following code snippet
# to generate the pie chart as in the following image.


pie_plot = adr_service.create_item(obj_name="Pie Plot", source="Documentation")
pie_plot.item_table = np.array([[10, 20, 50, 20]], dtype="|S20")
pie_plot.plot = "pie"
pie_plot.labels_column = ["Bar", "Triangle", "Quad", "Penta"]
pie_plot.visualize()


###############################################################################
#
# .. image:: /_static/pie_plot.png
#
# Visualize a heatmap
# -------------------
#
# Heatmaps are plots where at each (X,Y) position is associated the value of a
# variable, colored according to a legend. Here the snippet on how to create
# a heatmap representation - please note how nan values are also supported,
# resulting in empty cells.

heatmap = adr_service.create_item(obj_name="Heatmap", source="Documentation")
heatmap.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",
)
heatmap.plot = "heatmap"
heatmap.format = "floatdot0"
heatmap.visualize()


###############################################################################
#
# .. image:: /_static/heatmap.png
#
# Visualize a parallel coordinate plot
# ------------------------------------
#
# Parallel coordinate plots are especially useful when analyzing data coming
# from multiple runs. Place in each raw the values of variables for a given
# simulation. Each column is a different variable. The parallel coordinate
# plot allows you to visualize all this data in a way that stresses
# correlations between variables and runs.

parallel = adr_service.create_item()
parallel.item_table = np.array(
[
[54.2, 12.3, 1.45e5],
[72.3, 9.3, 4.34e5],
[45.4, 10.8, 8.45e4],
[67.4, 12.2, 2.56e5],
[44.8, 13.5, 9.87e4],
],
dtype="|S20",
)
parallel.labels_column = ["Temperature", "Max. Pressure", "Max. Work"]
parallel.plot = "parallel"
parallel.visualize()


###############################################################################
#
# .. image:: /_static/parallel_coord.png
#
# Visualize a Sankey diagram
# --------------------------
#
# A Sankey diagram allows you to visualize the relationship between
# different elements. For this reprenstation, place the information
# inside a squared table.

sankey_plot = adr_service.create_item()
sankey_plot.item_table = np.array(
[
[0, 0, 8, 2, 0, 0],
[0, 0, 0, 4, 0, 0],
[0, 0, 0, 0, 8, 0],
[0, 0, 0, 0, 5, 1],
[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0],
],
dtype="|S20",
)
sankey_plot.labels_row = ["A", "B", "C", "D", "E", "F"]
sankey_plot.labels_column = ["A", "B", "C", "D", "E", "F"]
sankey_plot.plot = "sankey"
sankey_plot.visualize()


###############################################################################
#
# .. image:: /_static/sankey.png
#
# Close the service
# -----------------
#
# Close the Ansys Dynamic Reporting service. The database with the items that
# were created remains on disk.

# sphinx_gallery_thumbnail_path = '_static/01_connect_3.png'
adr_service.stop()
Loading

0 comments on commit 76c64dd

Please sign in to comment.