flory.common.phases
Module providing common utilities to deal with phases and their composition.
Classes
Contains information about compositions and relative sizes of many phases. |
|
Contains compositions and relative sizes of many phases along with extra information. |
- class Phases(volumes, fractions)[source]
Bases:
objectContains information about compositions and relative sizes of many phases.
- Parameters:
volumes¶ (
ndarray) – 1D array with shape \(N_\mathrm{P}\), containing the volume \(J_p\) of each phase.fractions¶ (
ndarray) – 2D array with shape \(N_\mathrm{P} \times N_\mathrm{C}\), containing the volume fractions of the components in each phase \(\phi_{p,i}\). The first dimension must be the same asvolumes.
Public Data Attributes:
Number of phases \(N_\mathrm{P}\).
Number of components \(N_\mathrm{C}\).
Total volume of entire system
Mean fraction averaged over phases \(\bar{\phi}_i\)
Public Methods:
normalize the phases so that their volumes adds to one
sort()Sort the phases according to the index of most concentrated components.
get_clusters([dist])Find clusters of compositions.
Private Methods:
_copy(volumes, fractions)create copy with changed volume and fraction
- _copy(volumes, fractions)[source]
create copy with changed volume and fraction
This method helps with subclassing methods that should keep other information intact.
- Return type:
- sort()[source]
Sort the phases according to the index of most concentrated components.
- Returns:
The sorted phases.
- Return type:
- class PhasesResult(volumes, fractions, *, info=None)[source]
Bases:
PhasesContains compositions and relative sizes of many phases along with extra information.
- Parameters:
volumes¶ (
ndarray) – 1D array with shape \(N_\mathrm{P}\), containing the volume \(J_p\) of each phase.fractions¶ (
ndarray) – 2D array with shape \(N_\mathrm{P} \times N_\mathrm{C}\), containing the volume fractions of the components in each phase \(\phi_{p,i}\). The first dimension must be the same asvolumes.info¶ (
dict|None, default:None) – Additional information about how the phases were obtained.
Public Methods:
from_phases(phases, *[, info])create phase result from
PhasesInherited from
Phases:Private Methods:
_copy(volumes, fractions)create copy with changed volume and fraction
Inherited from
Phases:
- _copy(volumes, fractions)[source]
create copy with changed volume and fraction
This method helps with subclassing methods that should keep other information intact.
- Return type:
- get_clusters(dist=0.01)
Find clusters of compositions.
Find unique phases from compartments by clustering. The returning results are sorted according to the index of most concentrated components.
- sort()
Sort the phases according to the index of most concentrated components.
- Returns:
The sorted phases.
- Return type:
Functions
pick concentrations uniformly from allowed simplex (sum of fractions < 1) |