Metadata-Version: 2.4
Name: bio-curve-fit
Version: 1.1.1
Summary: Curve fitting algorithms for bio-assays with scikit-learn api
Project-URL: Repository, https://github.com/Ganymede-Bio/bio-curve-fit/
Author-email: Luke Schiefelbein <luke@ganymede.bio>
License: MIT
License-File: LICENSE
Keywords: bio-assay,curve-fitting,data-science,scikit-learn
Requires-Python: >=3.8.12
Requires-Dist: adjusttext>=1.2.0
Requires-Dist: importlib-metadata>=6.0; python_version < '3.8'
Requires-Dist: matplotlib>=3.7.1
Requires-Dist: pandas>=1.5.3
Requires-Dist: scikit-learn>=1.2.2
Provides-Extra: dev
Requires-Dist: coverage>=7.3.2; extra == 'dev'
Requires-Dist: data-science-types>=0.2.23; extra == 'dev'
Requires-Dist: ipykernel>=6.26.0; extra == 'dev'
Requires-Dist: ipython==8.12.2; extra == 'dev'
Requires-Dist: isort>=5.12.0; extra == 'dev'
Requires-Dist: mypy>=1.7.0; extra == 'dev'
Requires-Dist: pre-commit>=3.5.0; extra == 'dev'
Requires-Dist: pytest>=7.4.3; extra == 'dev'
Requires-Dist: ruff>=0.1.5; extra == 'dev'
Description-Content-Type: text/markdown


# bio-curve-fit

A Python package for fitting common dose-response and standard curve models. Designed to follow the [scikit-learn](https://scikit-learn.org/stable/) api.

## Quickstart 

### Installation

```shell
pip install bio-curve-fit
```


We recommend using python [virtual environments](https://docs.python.org/3/library/venv.html) to manage your python packages in an isolated environment. Example:

```shell
python -m venv venvname
source venvname/bin/activate
```

### Example usage:

```python
from bio_curve_fit.logistic import FourParamLogistic

# Instantiate model
model = FourParamLogistic()

# create some example data
standard_concentrations = [1, 2, 3, 4, 5]
standard_responses = [0.5, 0.55, 0.9, 1.25, 1.55]


# fit the model
model.fit(
	standard_concentrations, 
	standard_responses, 
)

# interpolate the response for new concentrations
model.predict([1.5, 2.5])

# interpolate the concentration for new responses
model.predict_inverse([0.1, 1.0])

```

Calculate and plot the curve and limits of detection:

```python
plot_standard_curve(standard_concentrations, standard_responses, model, show_plot=True)
```

![standard curve](./examples/readme_fit.png)

You can also customize the plot arbitrarily using matplotlib. For example, adding labels to the points:

```python
from adjustText import adjust_text

fig, ax = plot_standard_curve_figure(standard_concentrations, standard_responses, model)
texts = []
for x, y in zip(standard_concentrations, standard_responses):
	texts.append(ax.text(x, y, f"x={x:.2f}, y={y:.2f})", fontsize=13, ha="right"))
# Adjust text labels to avoid overlap
adjust_text(texts, ax=ax)
```

![standard curve with labels](./examples/readme_fit_labels.png)



## Examples

See the [example notebooks](./examples/) for more detailed usage.

## Contributing

Contributions are welcome! We built this package to be useful for our own work, but we know there is more to add.
Please see [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
