-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from biosustain/v1.2.x
V1.2.0
- Loading branch information
Showing
26 changed files
with
961 additions
and
673 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,39 @@ | ||
from croissance.estimation import Estimator | ||
from collections import namedtuple | ||
import pandas | ||
|
||
AnnotatedGrowthCurve = namedtuple('AnnotatedGrowthCurve', ('series', 'outliers', 'growth_phases')) | ||
import croissance.figures.plot | ||
|
||
from croissance.estimation import ( | ||
AnnotatedGrowthCurve, | ||
GrowthEstimationParameters, | ||
estimate_growth, | ||
) | ||
from croissance.estimation.util import normalize_time_unit | ||
|
||
def process_curve(curve: 'pandas.Series', **kwargs): | ||
estimator = Estimator(**kwargs) | ||
|
||
__all__ = [ | ||
"plot_processed_curve", | ||
"process_curve", | ||
] | ||
|
||
|
||
def process_curve( | ||
curve: "pandas.Series", | ||
segment_log_n0: bool = False, | ||
constrain_n0: bool = False, | ||
n0: float = 0.0, | ||
unit: str = "hours", | ||
): | ||
curve = normalize_time_unit(curve, unit) | ||
if curve.isnull().all(): | ||
return AnnotatedGrowthCurve(curve, [], []) | ||
return estimator.growth(curve) | ||
|
||
params = GrowthEstimationParameters() | ||
params.segment_log_n0 = segment_log_n0 | ||
params.constrain_n0 = constrain_n0 | ||
params.n0 = n0 | ||
|
||
return estimate_growth(curve, params=params) | ||
|
||
|
||
def plot_processed_curve(curve: AnnotatedGrowthCurve, yscale="both"): | ||
return croissance.figures.plot.plot_processed_curve(curve=curve, yscale=yscale) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.