ansys / pydpf-post

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

Expose streamlines #480

Closed PProfizi closed 11 months ago

PProfizi commented 11 months ago

Create the ansys.dpf.post.tools package, with the ansys.dpf.post.tools.streamlines module. Add the plot_streamlines helper to provide a first way of plotting streamlines based on a DataFrame. Add a first test in test_streamlines.py.

Initial mock-up: image

codecov[bot] commented 11 months ago

Codecov Report

Merging #480 (d67a405) into master (a713af2) will increase coverage by 0.27%. Report is 1 commits behind head on master. The diff coverage is 69.76%.

@@            Coverage Diff             @@
##           master     #480      +/-   ##
==========================================
+ Coverage   83.49%   83.77%   +0.27%     
==========================================
  Files          45       47       +2     
  Lines        5041     5072      +31     
==========================================
+ Hits         4209     4249      +40     
+ Misses        832      823       -9     
PProfizi commented 11 months ago

@rafacanton @cbellot000 @anslpa

Just realized we cannot actually create a ansys.dpf.post.tools sub-package with ansys.dpf.post.tools.streamlines module (ansys/dpf/post/tools/streamlines.py) as we already have a ansys.dpf.post.tools module (ansys/dpf/post/tools.py). Four solutions:

I think the first solution is the best.

What do you think?

rafacanton commented 11 months ago

@rafacanton @cbellot000 @anslpa

Just realized we cannot actually create a ansys.dpf.post.tools sub-package with ansys.dpf.post.tools.streamlines module (ansys/dpf/post/tools/streamlines.py) as we already have a ansys.dpf.post.tools module (ansys/dpf/post/tools.py). Four solutions:

  • rename the new sub-package from tools to helpers. This is the current solution implemented, so now the new method is in ansys.dpf.post.helpers.streamlines. This is also what was done in ansys-dpf-core which makes both libraries coherent.
  • Move the streamlines.py module directly in ansys/dpf/post
  • Move the streamlines helpers in the tools.py module, which would mean no streamlines-specific module and a direct call to from ansys.dpf.post.tools import plot_streamlines.
  • Remove the tools.py module and move its methods in a new module in the tools sub-package. This would mean makign sure that the old imports would still work. Not sure we can cover all edge-cases.

I think the first solution is the best.

What do you think?

@PProfizi I agree, I think it is right to have both libraries with a similar structure. Thanks!

PProfizi commented 11 months ago

@rafacanton @cbellot000 @anslpa Just realized we cannot actually create a ansys.dpf.post.tools sub-package with ansys.dpf.post.tools.streamlines module (ansys/dpf/post/tools/streamlines.py) as we already have a ansys.dpf.post.tools module (ansys/dpf/post/tools.py). Four solutions:

  • rename the new sub-package from tools to helpers. This is the current solution implemented, so now the new method is in ansys.dpf.post.helpers.streamlines. This is also what was done in ansys-dpf-core which makes both libraries coherent.
  • Move the streamlines.py module directly in ansys/dpf/post
  • Move the streamlines helpers in the tools.py module, which would mean no streamlines-specific module and a direct call to from ansys.dpf.post.tools import plot_streamlines.
  • Remove the tools.py module and move its methods in a new module in the tools sub-package. This would mean makign sure that the old imports would still work. Not sure we can cover all edge-cases.

I think the first solution is the best. What do you think?

@PProfizi I agree, I think it is right to have both libraries with a similar structure. Thanks!

What I ended-up doing: