-
Notifications
You must be signed in to change notification settings - Fork 11
/
__init__.py
39 lines (29 loc) · 927 Bytes
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import pandas
import croissance.figures.plot
from croissance.estimation import (
AnnotatedGrowthCurve,
GrowthEstimationParameters,
estimate_growth,
)
from croissance.estimation.util import normalize_time_unit
__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, [], [])
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)