Skip to content

Commit

Permalink
Add method to create fraction
Browse files Browse the repository at this point in the history
  • Loading branch information
schmoelder committed Jan 10, 2024
1 parent ab88659 commit 6fd2b4f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
6 changes: 3 additions & 3 deletions CADETProcess/fractionation/fractionator.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,9 @@ def _create_fraction(self, chrom_index, start, end):
Chromatogram fraction
"""
mass = self.chromatograms[chrom_index].fraction_mass(start, end)
volume = self.chromatograms[chrom_index].fraction_volume(start, end)
return Fraction(mass, volume)
fraction = self.chromatograms[chrom_index].create_fraction(start, end)

return fraction

def add_fraction(self, fraction, target):
"""Add Fraction to the FractionPool of target component.
Expand Down
22 changes: 22 additions & 0 deletions CADETProcess/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,28 @@ def integral(self, start=None, end=None):

return self.solution_interpolated.integral(start, end)

def create_fraction(self, start=None, end=None):
"""Create fraction in interval [start, end].
Parameters
----------
start : float
Start time of the fraction
end: float
End time of the fraction
Returns
-------
fraction : Fraction
Fraction
"""
from CADETProcess.fractionation import Fraction
mass = self.fraction_mass(start, end)
volume = self.fraction_volume(start, end)
return Fraction(mass, volume)

def fraction_mass(self, start=None, end=None):
"""Component mass in a fraction interval
Expand Down

0 comments on commit 6fd2b4f

Please sign in to comment.