Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing some plot stuff and small gallery improvements #2349

Merged
merged 57 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
2140445
Renaming file and changing thumbnail
germa89 Sep 19, 2023
08429e4
Small fix to doc build
germa89 Sep 19, 2023
c4baa48
Activating plots
germa89 Sep 19, 2023
ae535b7
Removing duplicated plots.
germa89 Sep 19, 2023
17d18fb
Increasing time build
germa89 Sep 20, 2023
4f411cd
Fixing mesh color bug
germa89 Sep 20, 2023
2dafec0
Using pytest-pyvista action for cache. Activating more tests. Improvi…
germa89 Sep 20, 2023
6d67ffb
Changing function name
germa89 Sep 20, 2023
f09d303
Removing unneeded eplot and prints in fixture
germa89 Sep 20, 2023
598a476
Grouping tests. Cosmetic changes
germa89 Sep 20, 2023
0a33d25
Merge branch 'fix/several-plot-fix' of https://github.com/pyansys/pym…
germa89 Sep 20, 2023
d5fe0da
Reorg tests.
germa89 Sep 20, 2023
bb6e510
Small fix to test
germa89 Sep 20, 2023
0e80cd2
Updating image cache
germa89 Sep 20, 2023
922366c
Updating cache
germa89 Sep 20, 2023
edb7cc5
Using a higher tolerance in bc legend tests
germa89 Sep 20, 2023
0229227
Updating image cache
germa89 Sep 20, 2023
3c43545
Adding pytest-pyvista configuration to fixture.
germa89 Sep 20, 2023
cc584e4
Updating image cache
germa89 Sep 20, 2023
19b5dff
Merge branch 'main' into fix/several-plot-fix
germa89 Sep 20, 2023
117356a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 20, 2023
a2476de
Updating cache image
germa89 Sep 20, 2023
3218610
Update image cache
germa89 Sep 21, 2023
a53d01a
Testing adding the files to the PR
germa89 Sep 21, 2023
cfdd076
Commenting out assertion
germa89 Sep 21, 2023
bc2a582
Merge branch 'main' into fix/several-plot-fix
germa89 Sep 21, 2023
cadde8d
commenting unused variable
germa89 Sep 21, 2023
e076b79
fixing yaml
germa89 Sep 21, 2023
69dae21
empty commit to trigger cicd
germa89 Sep 21, 2023
d17d5be
empty commit to reset the plotting.py file
germa89 Sep 21, 2023
8810620
Revent changes
germa89 Sep 21, 2023
9147809
fixing plot bug
germa89 Sep 21, 2023
3fa11c5
reventing ci.yml file
germa89 Sep 21, 2023
a46c5df
reverting to main
germa89 Sep 21, 2023
ea2e3cf
Adding files to PR
germa89 Sep 21, 2023
0d294e2
removing 'local' tag from git config
germa89 Sep 22, 2023
086b407
Fixing link in wsl
germa89 Sep 25, 2023
eb339ba
Updating image cache and removing PR part
germa89 Sep 25, 2023
cafa1ca
Merge branch 'fix/several-plot-fix' of https://github.com/pyansys/pym…
germa89 Sep 28, 2023
ca0004e
Merge branch 'main' into fix/several-plot-fix
germa89 Sep 28, 2023
f6fe979
Making sure the theme is applied at the beginning.
germa89 Sep 28, 2023
d7d2d4b
Improvement to bug template
germa89 Sep 28, 2023
8f6da42
Merge branch 'main' into fix/several-plot-fix
germa89 Oct 2, 2023
de03113
Resetting image cache to main
germa89 Oct 2, 2023
ee5c03d
recache some tests
germa89 Oct 2, 2023
b9cdfc8
removing dedundant tests
germa89 Oct 2, 2023
4167a39
removing codacy warning
germa89 Oct 2, 2023
42fb776
Removing some start imports
germa89 Oct 2, 2023
32d542c
Adding automatically missing images
germa89 Oct 2, 2023
380f753
Adding back useful stuff
germa89 Oct 2, 2023
0145ff0
Recache some test case senstive
germa89 Oct 2, 2023
2dbf2dc
Adding more fields to test to avoid pytest.pyvista names collision. S…
germa89 Oct 2, 2023
bf65985
Merge branch 'fix/several-plot-fix' of https://github.com/pyansys/pym…
germa89 Oct 2, 2023
14ce0b7
adding missing image cache
germa89 Oct 2, 2023
80ce921
Merge branch 'main' into fix/several-plot-fix
germa89 Oct 2, 2023
fea703c
Update the image cache
germa89 Oct 2, 2023
a6f772e
Empty comment to trigger CICD
germa89 Oct 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ body:
required: true
- label: I am using a [Python virtual environment](https://docs.python.org/3/library/venv.html).
required: true
- label: I am using the [latest version of PyMAPDL](https://github.com/ansys/pymapdl/releases) and its dependencies (fully updated virtual environment). You can update them using ``pip install --upgrade --upgrade-strategy eager ansys-mapdl-core``.
- label: I am using the [latest version of PyMAPDL](https://github.com/ansys/pymapdl/releases) and its dependencies (fully updated virtual environment). You can update them using ``pip install --upgrade --upgrade-strategy eager ansys-mapdl-core`` in your activated virtual environment.
required: true

- type: textarea
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ jobs:
if [[ "${{ matrix.mapdl-version }}" == *"ubuntu"* ]]; then export ON_UBUNTU=true;fi
xvfb-run pytest \
${{ env.PYTEST_ARGUMENTS }} \
--ignore_image_cache \
--cov-report=xml:centos-${{ matrix.mapdl-version }}-remote.xml

- uses: codecov/codecov-action@v3
Expand Down Expand Up @@ -516,7 +517,7 @@ jobs:
export AWP_ROOT222=/ansys_inc
xvfb-run pytest -k "not test_database and not test_dpf" \
${{ env.PYTEST_ARGUMENTS }} \
--reset_only_failed \
--reset_only_failed --add_missing_images \
--cov-report=xml:ubuntu-v22.2.0-local.xml

- name: "Adding the directory as safe directory for later step"
Expand Down Expand Up @@ -620,7 +621,7 @@ jobs:
set PYMAPDL_START_INSTANCE=
python -m pytest -k "not test_database and not test_dpf" \
${{ env.PYTEST_ARGUMENTS }} \
--skip-regression-check \
--ignore_image_cache \
--cov-report=xml:windows-v22.2.0-local.xml

- uses: codecov/codecov-action@v3
Expand Down
9 changes: 8 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
import os
import warnings

from ansys_sphinx_theme import ansys_favicon, get_version_match, pyansys_logo_black
from ansys_sphinx_theme import (
ansys_favicon,
get_version_match,
pyansys_logo_black,
pyansys_logo_white,
)
germa89 marked this conversation as resolved.
Show resolved Hide resolved
import numpy as np
import pyvista
from sphinx.application import Sphinx
Expand Down Expand Up @@ -236,6 +241,8 @@
"image_scrapers": ("pyvista", "matplotlib"),
"ignore_pattern": "flycheck*",
"thumbnail_size": (350, 350),
"remove_config_comments": True,
"default_thumb_file": pyansys_logo_white,
germa89 marked this conversation as resolved.
Show resolved Hide resolved
}
# ---

Expand Down
2 changes: 1 addition & 1 deletion doc/source/getting_started/wsl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ show how to use it together with MAPDL, PyMAPDL, and `Docker <https://www.docker

.. note::
Because WSL is under constant development, keeping this guide updated is difficult. If you
find any issues or have questions related to WSL, feel free to `open an issue in the GitHub repository <pymapdl_issues>`_.
find any issues or have questions related to WSL, feel free to `open an issue in the GitHub repository <pymapdl_issues_>`_.


Install WSL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
The Power Graphics style plot is then set up via PyVista.

"""
# sphinx_gallery_thumbnail_path = './_static/model_solenoid_2d.png'
germa89 marked this conversation as resolved.
Show resolved Hide resolved

import numpy as np
import pyvista as pv

Expand Down Expand Up @@ -292,9 +294,9 @@

plotter = pv.Plotter()

for i in range(0, len(grids)):
for i, grid in enumerate(grids):
plotter.add_mesh(
grids[i],
grid,
scalars=scalars[i],
show_edges=True,
cmap=PyMAPDL_cmap,
Expand Down
2 changes: 1 addition & 1 deletion examples/01-geometry/00-keypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
# plotting methods.
mapdl.kplot(
show_keypoint_numbering=True,
germa89 marked this conversation as resolved.
Show resolved Hide resolved
background="black",
background="white",
germa89 marked this conversation as resolved.
Show resolved Hide resolved
show_bounds=True,
font_size=26,
)
Expand Down
8 changes: 5 additions & 3 deletions src/ansys/mapdl/core/examples/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from .downloads import *
from .downloads import _download_rotor_tech_demo_plot, download_cfx_mapping_example_data
from .examples import *
from .downloads import (
download_bracket,
download_cfx_mapping_example_data,
download_manifold_example_data,
)
from .verif_files import vmfiles
2 changes: 1 addition & 1 deletion src/ansys/mapdl/core/examples/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def download_vtk_rotor():
return _download_file("rotor.vtk", "geometry")[0]


def _download_rotor_tech_demo_plot():
def _download_rotor_tech_demo_vtk():
"""Download the rotor surface VTK file."""
return _download_file("rotor2.vtk", "geometry")[0]

Expand Down
Binary file modified tests/.image_cache/aplot[False].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 modified tests/.image_cache/aplot[False]_1.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 modified tests/.image_cache/aplot[False]_2.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 modified tests/.image_cache/aplot[None].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 modified tests/.image_cache/aplot[None]_1.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 modified tests/.image_cache/aplot[None]_2.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 modified tests/.image_cache/aplot[None]_3.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 modified tests/.image_cache/aplot[True].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 modified tests/.image_cache/aplot[True]_1.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 modified tests/.image_cache/aplot[True]_2.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 modified tests/.image_cache/aplot[True]_3.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 tests/.image_cache/background.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 tests/.image_cache/bc_plot_bc_labels[CSGZ].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 tests/.image_cache/bc_plot_bc_labels[ux].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 tests/.image_cache/bc_plot_bc_target[Nodes].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/.image_cache/bc_plot_options[False-False-False].png
Binary file modified tests/.image_cache/bc_plot_options[False-True-False].png
Binary file modified tests/.image_cache/bc_plot_options[True-False-False].png
Binary file modified tests/.image_cache/bc_plot_options[True-True-False].png
Binary file added tests/.image_cache/cmplot_all[KP].png
Binary file added tests/.image_cache/cmplot_all[NODE].png
Binary file added tests/.image_cache/cmplot_individual[AREA].png
Binary file added tests/.image_cache/cmplot_individual[KP].png
Binary file added tests/.image_cache/cmplot_individual[LINE].png
Binary file added tests/.image_cache/cmplot_individual[NODE].png
Binary file added tests/.image_cache/cmplot_individual[VOLU].png
Binary file added tests/.image_cache/color_areas.png
Binary file modified tests/.image_cache/eplot[False].png
Binary file modified tests/.image_cache/eplot[False]_1.png
Binary file modified tests/.image_cache/eplot[False]_2.png
Binary file modified tests/.image_cache/eplot[None].png
Binary file modified tests/.image_cache/eplot[None]_1.png
Binary file modified tests/.image_cache/eplot[None]_2.png
Binary file modified tests/.image_cache/eplot[None]_3.png
Binary file modified tests/.image_cache/eplot[True].png
Binary file modified tests/.image_cache/eplot[True]_1.png
Binary file modified tests/.image_cache/eplot[True]_2.png
Binary file modified tests/.image_cache/eplot[True]_3.png
Binary file modified tests/.image_cache/eplot_savefig.png
Binary file modified tests/.image_cache/kplot[None].png
Binary file modified tests/.image_cache/kplot[True].png
Binary file modified tests/.image_cache/lplot[None].png
Binary file modified tests/.image_cache/lplot[True].png
Binary file added tests/.image_cache/nplot[None-False].png
Binary file added tests/.image_cache/nplot[None-True].png
Binary file added tests/.image_cache/nplot[True-False].png
Binary file added tests/.image_cache/nplot[True-True].png
Binary file added tests/.image_cache/plotter_input.png
Binary file added tests/.image_cache/show_bounds.png
Binary file added tests/.image_cache/vplot[None].png
Binary file added tests/.image_cache/vplot[True].png
28 changes: 14 additions & 14 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from ansys.mapdl.core.errors import MapdlExitedError, MapdlRuntimeError
from ansys.mapdl.core.examples import vmfiles
from ansys.mapdl.core.launcher import get_start_instance, launch_mapdl
from ansys.mapdl.core.theme import _apply_default_theme
from common import (
Element,
Node,
Expand All @@ -28,6 +29,8 @@
is_smp,
)

_apply_default_theme()

################################################################
#
# Setting testing environment
Expand Down Expand Up @@ -209,9 +212,20 @@ def pytest_collection_modifyitems(config, items):

@pytest.fixture(autouse=True)
def wrapped_verify_image_cache(verify_image_cache, pytestconfig):
# Checking if we want to avoid the check using pytest cli.
skip_regression_check = pytestconfig.option.skip_regression_check
if skip_regression_check:
verify_image_cache.skip = True

# Configuration
# default check
verify_image_cache.error_value = 500.0
verify_image_cache.warning_value = 200.0

# High variance test
verify_image_cache.var_error_value = 1000.0
verify_image_cache.var_warning_value = 1000.0

return verify_image_cache


Expand Down Expand Up @@ -703,7 +717,6 @@ def contact_geom_and_mesh(mapdl):
mapdl.vsweep("all")
mapdl.allsel("all")

# mapdl.eplot()
# ==========================================================
# * Contact Pairs
# ==========================================================
Expand Down Expand Up @@ -745,12 +758,10 @@ def contact_geom_and_mesh(mapdl):
mapdl.mat(1)
mapdl.asel("s", "", "", 5)
mapdl.nsla("", 1)
# mapdl.nplot()
mapdl.cm("tn.cnt", "node") # Creating component on weld side of plate1

mapdl.asel("s", "", "", 12)
mapdl.nsla("", 1)
# mapdl.nplot()
mapdl.cm("tn.tgt", "node") # Creating component on weld side of plate2

mapdl.allsel("all")
Expand All @@ -762,7 +773,6 @@ def contact_geom_and_mesh(mapdl):
# for welding, 'C
mapdl.real(6)
mapdl.cmsel("s", "tn.cnt")
# mapdl.nplot()
mapdl.esurf()
mapdl.type(7)
mapdl.real(6)
Expand Down Expand Up @@ -939,7 +949,6 @@ def cuadratic_beam_problem(mapdl):

mapdl.mp("EX", 1, 30e6)
mapdl.mp("PRXY", 1, 0.3)
print(mapdl.mplist())

w_f = 1.048394965
w_w = 0.6856481
Expand All @@ -954,18 +963,9 @@ def cuadratic_beam_problem(mapdl):
# Define one node for the orientation of the beam cross-section.
orient_node = mapdl.n(6, 60, 1)

# Print the list of the created nodes.
print(mapdl.nlist())

for elem_num in range(1, 5):
mapdl.e(elem_num, elem_num + 1, orient_node)

# Print the list of the created elements.
print(mapdl.elist())

# Display elements with their nodes numbers.
mapdl.eplot(show_node_numbering=True, line_width=5, cpos="xy", font_size=40)

# BC for the beams seats
mapdl.d(2, "UX", lab2="UY")
mapdl.d(4, "UY")
Expand Down
6 changes: 3 additions & 3 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from ansys.mapdl.core import EXAMPLES_PATH, examples
from ansys.mapdl.core.examples.downloads import (
_download_file,
_download_rotor_tech_demo_plot,
_download_rotor_tech_demo_vtk,
check_directory_exist,
delete_downloads,
download_bracket,
Expand Down Expand Up @@ -112,9 +112,9 @@ def test_download_vtk_rotor(running_test):
assert download_vtk_rotor() is True


def test__download_rotor_tech_demo_plot(running_test):
def test__download_rotor_tech_demo_vtk(running_test):
with running_test():
assert _download_rotor_tech_demo_plot() is True
assert _download_rotor_tech_demo_vtk() is True


def test_download_example_data(running_test):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def test_vext(mapdl, cleared):
carc0 = mapdl.circle(k0, 1, k1)
a0 = mapdl.al(*carc0)

# next, extrude it and plot it
# next, and extrude it
mapdl.vext(a0, dz=4)


Expand Down Expand Up @@ -153,7 +153,7 @@ def test_va(mapdl, cleared):
a2 = mapdl.a(k1, k2, k3)
a3 = mapdl.a(k0, k2, k3)

# generate and plot the volume
# generate the volume
vnum = mapdl.va(a0, a1, a2, a3)
assert vnum == 1

Expand Down
Loading