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

Refactor Pathway class #305

Merged
merged 25 commits into from
Apr 22, 2024
Merged

Refactor Pathway class #305

merged 25 commits into from
Apr 22, 2024

Conversation

stefsmeets
Copy link
Contributor

@stefsmeets stefsmeets commented Apr 15, 2024

This PR refactors the Pathway class. I endend up tackling a bunch of cascading issues. It changes the following:

  • Add .dims attribute to Pathway. This simplifies a bunch of site transformations that before depended on passing a volume
  • Add method to calculate Pathway total length
  • Move frac_sites / wrap to methods that return sites instead of in-place updates
  • Pathway.path_over_structure returns list of PeriodicSite which simplifies return statement and gives more options to user
  • Move some plots to methods of Pathway
  • Streamlines creation of Pathways object from Volume
  • Path plots no longer needs Volume because Pathway now has dims
  • Rename path functions to hopefully make them a bit more consistent

Todo

@stefsmeets
Copy link
Contributor Author

stefsmeets commented Apr 16, 2024

Hi @SCiarella could you review this pr please? It may seem like a bit much, but I think it is easiest to start with the Pathway refactor, most of the other changes follow from there. And then Volume next. Changes to both classes enabled a bunch of other small changes and corrections that I included (e.g. plots).

I'm happy to talk you through it offline.

@stefsmeets stefsmeets requested a review from SCiarella April 16, 2024 13:28
Copy link
Contributor

@SCiarella SCiarella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks excellent! 🚀

My only comment is that I am not convinced that wrapped_sites should be optional. I would make it mandatory, or at least default on True.

src/gemdat/path.py Show resolved Hide resolved
src/gemdat/path.py Outdated Show resolved Hide resolved
src/gemdat/path.py Show resolved Hide resolved
src/gemdat/plots/matplotlib/_paths.py Outdated Show resolved Hide resolved
src/gemdat/volume.py Show resolved Hide resolved
Co-authored-by: SCiarella <58949181+SCiarella@users.noreply.github.com>
@stefsmeets
Copy link
Contributor Author

Good point on the wrapping! I'll go through that part again with this in mind.

@stefsmeets stefsmeets merged commit 79fbfb2 into main Apr 22, 2024
4 checks passed
@stefsmeets stefsmeets deleted the pathway275 branch April 22, 2024 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants