qiangyicheng / flory

Python package for finding coexisting phases in multicomponent mixtures.
https://flory.readthedocs.io/en/latest/
MIT License
4 stars 1 forks source link

Changed the return type from a tuple to a separate class #5

Closed david-zwicker closed 2 months ago

david-zwicker commented 2 months ago

I hope this avoids errors (so one does not need to remember whether the phase volume was the first or second entry). The class also allows to add convenience methods and some checks if we want this later.

david-zwicker commented 2 months ago

I currently base the new Phases class on the tuple approach that we had so far, so the class works as a drop-in replacement. However, we could also decide to get rid of the tuples completely (particularly in the examples) and base everything on class access.

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 84.78261% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
flory/common/phases.py 82.92% 7 Missing :warning:
Flag Coverage Δ
Tests 68.78% <84.78%> (-2.12%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
flory/mcmp/_finder_impl.py 99.17% <ø> (+0.63%) :arrow_up:
flory/mcmp/finder.py 71.42% <100.00%> (-2.65%) :arrow_down:
flory/shortcut.py 100.00% <100.00%> (ø)
flory/common/phases.py 82.92% <82.92%> (ø)

... and 7 files with indirect coverage changes

david-zwicker commented 2 months ago

We should also discuss whether we should call the fields Js and phis or rather volumes and fractions or something similar.

qiangyicheng commented 2 months ago

I like this! For exposing the clustering threshold, can we let the Phases class also hold the original phis and Js as private members? Then we can re-cluster the phases when needed.

david-zwicker commented 2 months ago

Let's discuss this in person some time this week!