Skip to content

Commit

Permalink
Merge pull request #8 from biosustain/v1.2.x
Browse files Browse the repository at this point in the history
V1.2.0
  • Loading branch information
meono authored Aug 9, 2021
2 parents 441120a + 35c50f3 commit 284d084
Show file tree
Hide file tree
Showing 26 changed files with 961 additions and 673 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
*.so

# Packages
*.egg
*.egg-info
*.egg*
dist
build
eggs
Expand All @@ -18,6 +17,7 @@ develop-eggs
lib
lib64
__pycache__
venv

# Installer logs
pip-log.txt
Expand All @@ -35,8 +35,9 @@ nosetests.xml
.project
.pydevproject

# PyCharm
# IDEs
.idea
.vscode

# Test output
test.*.pdf
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ language: python
cache:
- pip: true
python:
- "3.5"
- "3.6"
before_install:
- |
- |
mkdir -p $HOME/.config/matplotlib && \
echo 'backend: agg' > $HOME/.config/matplotlib/matplotlibrc
install:
- "pip install ."
script: python setup.py test
- pip install .
- pip install pytest
script: pytest tests
36 changes: 30 additions & 6 deletions croissance/__init__.py
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)
97 changes: 0 additions & 97 deletions croissance/__main__.py

This file was deleted.

Loading

0 comments on commit 284d084

Please sign in to comment.