ansys / pydpf-post

Data Processing Framework - Post Processing Module
https://post.docs.pyansys.com
MIT License
43 stars 10 forks source link

Bug located in Temperature Plotting - module 'numpy' has no attribute 'int' #254

Closed giiyms closed 1 year ago

giiyms commented 1 year ago

Before submitting the issue

Description of the bug

Hello,

I am trying to plot the temperature results of a .rth using Pyansys Post and plot_contour function and am running into this error:

Traceback (most recent call last):
  File "\.venv\lib\site-packages\IPython\core\interactiveshell.py", line 3442, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-23-d6a430c4a034>", line 2, in <module>
    pl = temp.plot_contour()  #
  File "\.venv\lib\site-packages\ansys\dpf\post\result_data.py", line 412, in plot_contour
    pl.plot_contour(fc, **kwargs)
  File "\.venv\lib\site-packages\ansys\dpf\core\plotter.py", line 732, in plot_contour
    ind, mask = mesh_location.map_scoping(field.scoping)
  File "\.venv\lib\site-packages\ansys\dpf\core\nodes.py", line 329, in map_scoping
    ind = arr[mask].astype(np.int)
  File "\.venv\lib\site-packages\numpy\__init__.py", line 284, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'int'

Steps To Reproduce

from ansys.dpf import post
from ansys.dpf.post import examples
solution = post.load_solution(examples.steady_therm)
temperature = solution.temperature()
temp = temperature.scalar
pl = temp.plot_contour()

Which Operating System are you using?

Windows

Which Python version are you using?

3.10

Installed packages

ansys-api-fluent==0.3.5 ansys-api-mapdl==0.5.1 ansys-api-platform-instancemanagement==1.0.0b3 ansys-dpf-core==0.6.0 ansys-dpf-gate==0.2.1 ansys-dpf-gatebin==0.3.0 ansys-dpf-post==0.2.5 ansys-fluent-core==0.11.0 ansys-grantami-bomanalytics==1.0.1 ansys-grantami-bomanalytics-openapi==1.0.0 ansys-grpc-dpf==0.7.0 ansys-mapdl-core==0.63.2 ansys-mapdl-reader==0.52.6 ansys-openapi-common==1.1.1 ansys-platform-instancemanagement==1.0.2 appdirs==1.4.4 cachetools==5.2.1 certifi==2022.12.7 cffi==1.15.1 charset-normalizer==2.1.1 clr-loader==0.2.5 colorama==0.4.6 contourpy==1.0.6 cryptography==39.0.0 cycler==0.11.0 fonttools==4.38.0 geomdl==5.3.1 google-api-core==2.10.1 google-api-python-client==2.71.0 google-auth==2.15.0 google-auth-httplib2==0.1.0 googleapis-common-protos==1.56.4 grpcio==1.51.1 h5py==3.7.0 httplib2==0.21.0 idna==3.4 imageio==2.24.0 importlib-metadata==6.0.0 kiwisolver==1.4.4 matplotlib==3.6.2 ntlm-auth==1.5.0 numpy==1.24.1 packaging==23.0 pandas==1.5.2 Pillow==9.4.0 plumbum==1.8.1 pooch==1.6.0 protobuf==3.20.1 protoc-gen-swagger==0.1.0 psutil==5.9.4 pyaedt==0.6.3 pyansys==2023.1.1 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycparser==2.21 pyiges==0.2.1 pyparsing==3.0.9 pypiwin32==223 python-dateutil==2.8.2 pythonnet==3.0.0rc6 pytz==2022.7 pyvista==0.37.0 pywin32==305 requests==2.28.1 requests-negotiate-sspi==0.5.2 requests-ntlm==1.1.0 rpyc==5.0.1 rsa==4.9 scipy==1.10.0 scooby==0.7.0 six==1.16.0 tqdm==4.64.1 uritemplate==4.1.1 urllib3==1.26.13 vtk==9.2.5 zipp==3.11.0

PProfizi commented 1 year ago

hi @giiyms,

Unfortunately the latest releases of numpy (>=1.24) deprecated np.int as well as np.float and others. This is being fixed in the dependencies of pydpf-post but in the meantime a simple fix is to use numpy==1.23.*.

PProfizi commented 1 year ago

Sorry, misclicked. Do not hesitate to comment with further questions or close if this solves your issue. Later releases of pydpf-core and pydpf-post will be compatible with numpy>=1.24.

giiyms commented 1 year ago

Thank you for quick response