calisim

A toolbox for the calibration and evaluation of simulation models.

https://github.com/plant-food-research-open/calisim

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.0%) to scientific vocabulary

Keywords

abc active-learning approximate-bayesian-computation bayesian-calibration bayesian-optimization bayesian-quadrature evolutionary-algorithms experimental-design history-matching model-calibration optimal-experimental-design optimisation reliability-analysis sbi sensitivity-analysis simulation-based-inference surrogate-based-optimization surrogate-models uncertainty-analysis uncertainty-quantification
Last synced: 4 months ago · JSON representation ·

Repository

A toolbox for the calibration and evaluation of simulation models.

Basic Info
  • Host: GitHub
  • Owner: Plant-Food-Research-Open
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Homepage: https://calisim.readthedocs.io
  • Size: 7.11 MB
Statistics
  • Stars: 15
  • Watchers: 9
  • Forks: 2
  • Open Issues: 14
  • Releases: 16
Topics
abc active-learning approximate-bayesian-computation bayesian-calibration bayesian-optimization bayesian-quadrature evolutionary-algorithms experimental-design history-matching model-calibration optimal-experimental-design optimisation reliability-analysis sbi sensitivity-analysis simulation-based-inference surrogate-based-optimization surrogate-models uncertainty-analysis uncertainty-quantification
Created about 1 year ago · Last pushed 5 months ago
Metadata Files
Readme Contributing License Code of conduct Citation Security

README.md


Python pypi License Ruff pre-commit security: bandit Coverage Lint Test Publish Build CodeQL Advanced

PyPI | Documentation | API | Changelog | Examples | Releases | Docker

A toolbox for the calibration and evaluation of simulation models.

Table of contents

Introduction

calisim is an open-source, low-code model calibration library that streamlines and standardises your workflows, while aiming to be as flexible and extensible as needed to support more complex use-cases. Using calisim will speed up your experiment cycle substantially and make you more productive.

calisim is primarily a wrapper around popular libraries and frameworks including Optuna, PyMC, scikit-learn, and emcee among many others. The design and simplicity of calisim was inspired by the scikit-learn and PyCaret libraries.

Features and Functionality

  • A standardised and streamlined interface to multiple calibration procedures and libraries.
  • A low-code library, allowing modellers to rapidly construct multiple workflows for many calibration procedures.
  • An object-oriented programming architecture, allowing users to easily extend and modify calibration workflows for their own complex modelling use-cases.
  • An unopinionated approach to working with simulation models, allowing users to calibrate both Python-based and non-Python-based models.
  • Optional integration with PyTorch for access to more sophisticated Gaussian Process and deep learning surrogate models, state-of-the-art evolutionary algorithms, and deep generative modelling for simulation-based inference.

Quickstart

```

Load imports

import numpy as np import pandas as pd

from calisim.datamodel import ( DistributionModel, ParameterDataType, ParameterSpecification, ) from calisim.examplemodels import LotkaVolterraModel from calisim.optimisation import OptimisationMethod, OptimisationMethodModel from calisim.statistics import MeanSquaredError from calisim.utils import getexamplesoutdir

Get model

model = LotkaVolterraModel() observeddata = model.getobserved_data()

Specify model parameter distributions

parameterspec = ParameterSpecification( parameters=[ DistributionModel( name="alpha", distributionname="uniform", distributionargs=[0.45, 0.55], datatype=ParameterDataType.CONTINUOUS, ) ] )

Define objective function

def objective( parameters: dict, simulationid: str, observeddata: np.ndarray | None, t: pd.Series ) -> float | list[float]: simulation_parameters = dict( alpha=parameters["alpha"], beta=0.024, h0=34.0, l0=5.9, t=t, gamma=0.84, delta=0.026, )

simulated_data = model.simulate(simulation_parameters).lynx.values
metric = MeanSquaredError()
discrepancy = metric.calculate(observed_data, simulated_data)
return discrepancy

Specify calibration parameter values

specification = OptimisationMethodModel( experimentname="optunaoptimisation", parameterspec=parameterspec, observeddata=observeddata.lynx.values, outdir=getexamplesoutdir(), method="tpes", directions=["minimize"], niterations=100, methodkwargs=dict(nstartuptrials=50), calibrationfunckwargs=dict(t=observed_data.year), )

Choose calibration engine

calibrator = OptimisationMethod( calibration_func=objective, specification=specification, engine="optuna" )

Run the workflow

calibrator.specify().execute().analyze()

View the results

resultartifacts = "\n".join(calibrator.getartifacts()) print(f"View results: \n{resultartifacts}") print(f"Parameter estimates: {calibrator.getparameter_estimates()}") ```

Installation

The easiest way to install calisim is by using pip:

pip install calisim

calisim's default installation will not include all optional dependencies. You may be interested in one or more extras:

```

Install PyTorch extras

pip install calisim[torch]

Install Hydra extras

pip install calisim[hydra]

Install TorchX extras

pip install calisim[torchx]

Install multiple extras

pip install calisim[torch,hydra,torchx] ```

Usage with Docker

You may also want to execute calisim inside of a Docker container. You can do so by running the following:

```

Change the image version as needed

export CALISIM_VERSION=latest

Get docker-compose.yaml file

wget https://raw.githubusercontent.com/Plant-Food-Research-Open/calisim/refs/heads/main/docker-compose.yaml

Pull the image

docker compose pull calisim

Run an example

docker compose run --rm calisim python examples/optimisation/optuna_example.py ```

Communication

Please refer to the following links:

Contributions and Support

Contributions are more than welcome. For general guidelines on how to contribute to this project, take a look at CONTRIBUTING.md.

License

calisim is published under the Apache License (see LICENSE).

View all third party licenses (see third_party)

Owner

  • Name: Plant-Food-Research-Open
  • Login: Plant-Food-Research-Open
  • Kind: organization

Citation (CITATION.cff)

cff-version: 1.2.0
message: If you use this software, please cite it using these metadata.
authors:
  - family-names: "Bristow"
    given-names: "James"
    orcid: "https://orcid.org/0009-0002-3381-7466"
  - family-names: "Liang"
    given-names: "Hana"
    orcid: "https://orcid.org/0009-0008-3342-5028"
  - family-names: "Zhang"
    given-names: "Jingjing"
    orcid: "https://orcid.org/0000-0001-8809-3405"
  - family-names: "Zhu"
    given-names: "Junqi"
    orcid: "https://orcid.org/0000-0002-9093-651X"
  - family-names: "Van Houtte"
    given-names: "Chris"
    orcid: "https://orcid.org/0000-0003-4428-9208"
title: "calisim: A toolbox for the calibration and evaluation of simulation models"
version: 0.6.0
date-released: 2025-04-27
license: Apache-2.0
url: "https://github.com/Plant-Food-Research-Open/calisim"

GitHub Events

Total
  • Create event: 35
  • Release event: 17
  • Issues event: 21
  • Watch event: 13
  • Delete event: 21
  • Member event: 1
  • Issue comment event: 24
  • Push event: 215
  • Public event: 1
  • Gollum event: 1
  • Pull request event: 29
  • Fork event: 2
Last Year
  • Create event: 35
  • Release event: 17
  • Issues event: 21
  • Watch event: 13
  • Delete event: 21
  • Member event: 1
  • Issue comment event: 24
  • Push event: 215
  • Public event: 1
  • Gollum event: 1
  • Pull request event: 29
  • Fork event: 2

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 13
  • Total pull requests: 19
  • Average time to close issues: about 2 months
  • Average time to close pull requests: about 2 months
  • Total issue authors: 3
  • Total pull request authors: 2
  • Average comments per issue: 0.38
  • Average comments per pull request: 0.32
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 18
Past Year
  • Issues: 13
  • Pull requests: 19
  • Average time to close issues: about 2 months
  • Average time to close pull requests: about 2 months
  • Issue authors: 3
  • Pull request authors: 2
  • Average comments per issue: 0.38
  • Average comments per pull request: 0.32
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 18
Top Authors
Issue Authors
  • JBris (9)
  • hanaliangpnf (3)
  • HeatherKJenkins (1)
Pull Request Authors
  • dependabot[bot] (17)
  • JBris (1)
Top Labels
Issue Labels
enhancement (4) bug (2) python (2) help wanted (1) documentation (1)
Pull Request Labels
dependencies (17) python (15)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 78 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 11
  • Total maintainers: 1
pypi.org: calisim

A toolbox for the calibration and evaluation of simulation models.

  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 78 Last month
Rankings
Dependent packages count: 9.5%
Average: 31.4%
Dependent repos count: 53.3%
Maintainers (1)
Last synced: 5 months ago

Dependencies

.github/workflows/build.yaml actions
  • actions/checkout v3 composite
  • docker/login-action v2 composite
  • docker/setup-buildx-action v3 composite
  • docker/setup-qemu-action v3 composite
.github/workflows/codeql.yaml actions
  • actions/checkout v4 composite
  • github/codeql-action/analyze v3 composite
  • github/codeql-action/init v3 composite
.github/workflows/lint.yaml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
  • snok/install-poetry v1 composite
.github/workflows/test.yaml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • snok/install-poetry v1 composite
Dockerfile docker
  • base latest build
  • python 3.10.13-bullseye build
.github/workflows/publish.yaml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
  • snok/install-poetry v1 composite
poetry.lock pypi
  • 321 dependencies
pyproject.toml pypi
  • coverage ^7.6.3 develop
  • ipython ^8.28.0 develop
  • ipywidgets ^8.1.5 develop
  • jupyter-core ^5.7.2 develop
  • jupyterlab ^4.3.1 develop
  • mypy ^1.12.0 develop
  • pre-commit ^4.0.1 develop
  • pytest ^8.3.3 develop
  • pytest-cov ^5.0.0 develop
  • pytest-env ^1.1.5 develop
  • pytest-mock ^3.14.0 develop
  • pytest-xdist ^3.6.1 develop
  • ruff ^0.7.0 develop
  • types-pyyaml ^6.0.12.20240917 develop
  • autodoc-pydantic ^2.2.0 docs
  • myst-nb ^1.1.2 docs
  • sphinx ^8.1.3 docs
  • sphinx-argparse ^0.5.2 docs
  • sphinx-rtd-theme ^3.0.1 docs
  • sphinxcontrib-applehelp ^2.0.0 docs
  • sphinxcontrib-devhelp ^2.0.0 docs
  • sphinxcontrib-htmlhelp ^2.1.0 docs
  • sphinxcontrib-jsmath ^1.0.1 docs
  • sphinxcontrib-qthelp ^2.0.0 docs
  • sphinxcontrib-serializinghtml ^2.0.0 docs
  • alembic ^1.13.3
  • arviz ^0.20.0
  • ax-platform ^0.4.3
  • botorch ^0.12.0
  • celery ^5.4.0
  • chaospy ^4.3.17
  • corner ^2.2.3
  • emcee ^3.1.6
  • emukit ^0.4.11
  • gpy ^1.13.2
  • gpytorch ^1.13
  • graphviz ^0.20.3
  • gstools ^1.6.0
  • hydra-core ^1.3.2
  • iterative-ensemble-smoother ^0.2.6
  • joblib ^1.4.2
  • kaleido 0.2.1
  • lampe ^0.9.0
  • matplotlib ^3.9.2
  • mesa <3.1.4
  • mesa-geo ^0.9.1
  • networkx ^3.4.1
  • nflows ^0.14
  • numpoly <= 1.2.14
  • numpy <2.0.0
  • openturns ^1.23
  • optuna ^4.0.0
  • pandas ^2.2.3
  • pcse ^6.0.9
  • pillow ^11.0.0
  • plotly ^5.24.1
  • psycopg2-binary ^2.9.10
  • pyabc ^0.12.13
  • pydantic ^2.9.2
  • pyesmda ^0.4.3
  • pygpc ^0.4.1
  • pymc <=5.16.2
  • pyro-api ^0.1.2
  • pyro-ppl ^1.9.1
  • pytensor <=2.20.0
  • python >=3.10,<3.11
  • pyyaml ^6.0.2
  • salib ^1.5.1
  • sbi <=0.22.0
  • scikit-activeml ^0.5.2
  • scikit-learn ^1.5.2
  • scipy <1.12.0
  • seaborn ^0.13.2
  • skorch ^1.0.0
  • spotpy ^1.6.2
  • sqlalchemy <2.0.36
  • tensorboard ^2.18.0
  • torch ^2.5.0
  • zuko ^1.3.0