Biomass

Latest version: v0.14.0

Safety actively analyzes 714860 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 4 of 4

0.5.2

- Template
- Update `viz.py`

Use this template for creating models with `biomass>=0.5.2`

python
from matplotlib import pyplot as plt

from biomass.plotting import *

from .observable import Observable


class Visualization(Observable):
"""
Plotting parameters for customizing figure properties.

Attributes
----------
cm : matplotlib.colors.ListedColormap (default: `plt.cm.get_cmap('tab10')`)
Choosing colormaps for `cmap`.
single_observable_options : list of SingleObservable
Visualization options for time-course simulation (single-observable).
multiple_observables_options : MultipleObservables
Visualization options for time-course simulation (multi-observables).
sensitivity_options : SensitivityOptions
Visualization options for sensitivity analysis results.
"""

def __init__(self):
super().__init__()

self.cm = plt.cm.get_cmap("tab10")
self.single_observable_options = [
SingleObservable(self.cm, obs_name) for obs_name in self.obs_names
]
self.multiple_observables_options = MultipleObservables(self.cm)
self.sensitivity_options = SensitivityOptions(self.cm)

def get_single_observable_options(self):

return self.single_observable_options

def get_multiple_observables_options(self):

return self.multiple_observables_options

def get_sensitivity_options(self):

return self.sensitivity_options

staticmethod
def set_timecourse_rcParams():
"""figure/simulation"""
plt.rcParams["font.size"] = 12
plt.rcParams["axes.linewidth"] = 1.5
plt.rcParams["xtick.major.width"] = 1.5
plt.rcParams["ytick.major.width"] = 1.5
plt.rcParams["lines.linewidth"] = 1.8
plt.rcParams["lines.markersize"] = 12
plt.rcParams["savefig.bbox"] = "tight"
plt.rcParams["savefig.format"] = "pdf"
plt.rcParams['font.family'] = 'Arial'
plt.rcParams['mathtext.fontset'] = 'custom'
plt.rcParams['mathtext.it'] = 'Arial:italic'

staticmethod
def set_sensitivity_rcParams():
"""figure/sensitivity"""
plt.rcParams["font.size"] = 12
plt.rcParams["axes.linewidth"] = 1.2
plt.rcParams["xtick.major.width"] = 1.2
plt.rcParams["ytick.major.width"] = 1.2
plt.rcParams["savefig.bbox"] = "tight"
plt.rcParams["savefig.format"] = "pdf"
plt.rcParams['font.family'] = 'Arial'

staticmethod
def convert_species_name(name):
"""figure/sensitivity/initial_condition
- Sensitivity for species with nonzero initial conditions
"""
return name


- Core functions

- Fix default workers in `optimize` function (58)

- Parameter estimation

- Fix a bug (59)

- Other

- Bump minimal sicpy version to 1.6
- `integrate.simps` was renamed to `integrate.simpson`

0.5.1

- Template
- Add new key: `legend_kws`
- `legend_loc` becomes invalid
- Several updates to default rcParams

- Core functions
- Remove `save_format` from arguments in `run_simulation` and `run_analysis`
- To modify save_format, edit `viz.py` in the model.
- Use `x_id` to specify the index (indices) of parameter sets when running `optimize`
- `start` and `end` become invalid
- Add `create_metrics : Dict[str, Callable[[np.ndarray], Union[int, float]]], optional` to `run_analysis`
- Allowing users to crete signaling metrics for sensitivity analysis

0.5.0

- Dependencies

- Add [pandas](https://pandas.pydata.org) (See `requirements.txt`)

- Template

- Update `fitness.py`
- Create `OptimizationProblem`
- Add `bounds` for external optimizer

- Update `viz.py`
- Add `figsize` (default: (4, 3)) to timecourse_options and multiplot_options

- `biomass.result`

- Move visualization of estimated parameter sets to biomass.OptimizationResults.savefig()

python
>>> from biomass import Model, OptimizationResults
>>> from biomass.models import Nakakuki_Cell_2010
>>> model = Model(Nakakuki_Cell_2010.__package__).create()
>>> res = OptimizationResults(model)
>>> res.savefig(figsize=(16,5), boxplot_kws={"orient": "v"})


![](https://raw.githubusercontent.com/biomass-dev/biomass/develop/docs/_static/img/estimated_parameter_sets.png)

- `biomass.estimation`

- Create new class: `ExternalOptimizer`
python
>>> from scipy.optimize import differential_evolution
>>> from biomass import Model
>>> from biomass.models import Nakakuki_Cell_2010
>>> model = Model(Nakakuki_Cell_2010.__package__).create()
>>> optimizer = ExternalOptimizer(model, differential_evolution)
>>> res = optimizer.run(
... model.problem.objective,
... model.problem.bounds,
... strategy="best2bin",
... maxiter=100,
... tol=1e-4,
... mutation=0.1,
... recombination=0.5,
... disp=True,
... polish=False,
... workers=-1,
... )

> differential_evolution step 1: f(x)= 7.05589
> differential_evolution step 2: f(x)= 5.59166
> differential_evolution step 3: f(x)= 2.80301
> ...
> differential_evolution step 100: f(x)= 0.538524

python
>>> from biomass import run_simulation
>>> optimizer.import_solution(res.x, x_id=0)
>>> run_simulation(model, viz_type="0")

Page 4 of 4

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.