KinBiont.jl#
pykinbiont is a thin Python bridge over KinBiont.jl, a Julia package for model-based analysis of microbial kinetics data developed by the Pinheiro Group.
What KinBiont provides#
KinBiont implements the full analysis pipeline in Julia:
Preprocessing — smoothing (LOWESS, rolling average, Gaussian), blank subtraction, scattering correction, negative-value handling, stationary-phase trimming
Nonlinear fitting — closed-form growth models (logistic, Gompertz, Richards, Baranyi, …) via
Optim.jlODE fitting — SciML-powered fitting for custom differential equation models
Data-Driven Differential Equations (DDDE) — sparse regression to discover ODEs from data
Model selection — AICc-based automatic selection across multiple candidate models
Clustering — k-means clustering of curve shapes with centroid extraction
Julia resources#
Resource |
Link |
|---|---|
KinBiont.jl source |
|
Julia downloads |
|
PythonCall / juliacall |
|
juliapkg |
How pykinbiont calls Julia#
pykinbiont uses juliacall to start a Julia process in the same Python session. The bridge is transparent:
Python
GrowthData/FitOptions/ModelSpecobjects are converted to their Julia counterparts inpykinbiont._convert.Kinbiont.kinbiont_fit()orKinbiont.preprocess()is called from Python.The Julia result structs are converted back to Python dataclasses.
For custom Python models (NLModel / ODEModel with a func argument), pykinbiont creates a
Julia closure that calls back into Python via PythonCall’s pyconvert:
# Generated at runtime for each custom NLModel
(p, t) -> PythonCall.pyconvert(Vector{Float64}, pyfunc(p, t))
This means custom model functions are executed in Python on every optimizer call. For performance-critical work, define the model in Julia directly.
Accessing Julia directly#
If you need to call KinBiont.jl functions not yet exposed by pykinbiont, you can access the Julia module directly:
import pykinbiont
pykinbiont.init() # ensure Julia is started
jl = pykinbiont.get_jl() # returns the juliacall Main module
print(list(jl.Kinbiont.MODEL_REGISTRY.keys()))
All juliacall features (type conversions, seval, etc.) are available through get_jl().
Version compatibility#
pykinbiont |
KinBiont.jl |
|---|---|
0.2.x |
≥ 1.2.0 |
KinBiont.jl 1.2 introduced the unified FitOptions struct and ModelSpec API that
pykinbiont 0.2 relies on. Earlier KinBiont versions are not supported.