Skip to main content

Surrogate modeling and Bayesian calibration of chromatographic processes using CADET and Gaussian Processes.

Project description

A lightweight Python library that couples the CADET process simulator with modern sensitivity analysis, Gaussian-process surrogates, and diagnostic tools.

✨ Highlights

  • Vectorized KPI extractor – Compute retention time, peak width, and number of plates from any simulation in one call (chromasurr.metrics.extract)

  • Global Sobol sensitivity – One-liner run_sensitivity_analysis() to rank parameters with Saltelli sampling and automatic metric extraction

  • Gaussian-process surrogate manager – The Surrogate class trains, prunes, and re-trains emulators in log-space; includes built-in sensitivity on the GP itself

  • Reusable process builder – The BatchElution class provides a ready-to-use CADET process object with configurable parameters like cycle time and feed duration

  • End-to-end example – Full demo in examples/chromasurr_demo.py covering sensitivity analysis, calibration, and UQ

🚀 Quick start

Run the demo in ≈ 60 seconds:

# 1. Clone the repository
git clone https://github.com/talasunna/chromasurr.git && cd chromasurr

# 2. Create environment (Python ≥ 3.10)
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt

# 3. Launch the demo
python examples/chromasurr_demo.py

This runs a full workflow using a preconfigured BatchElution process and guides you through GP surrogate modeling, Sobol sensitivity analysis, and Bayesian calibration.

📦 Installation

pip install git+https://github.com/talasunna/chromasurr.git

Note – CADET-Core must be installed or compiled on your system. See the CADET-Core Installation Guide for details.

CADET-Process is automatically installed via pip when installing chromasurr.

🛠️ Usage at a glance

 from chromasurr.surrogate import Surrogate
 from chromasurr.uq import perform_monte_carlo_uq, latin_hypercube_sampler
 from chromasurr.visualize import sobol_indices, summarize_results, uq_distribution
 from chromasurr.process.batch_elution import BatchElution

 # 1. Instantiate a configurable process object
 proc = BatchElution(cycle_time=600.0, feed_duration=50.0)

 # 2. Set up parameter configuration and choose metric
 param_config = {
      "ax_disp": "flow_sheet.column.axial_dispersion",
      "porosity": "flow_sheet.column.total_porosity",
  }
  bounds = {
      "ax_disp": [1e-6, 1e-2],
      "porosity": [0.35, 0.95],
  }
  metrics = ["peak_width"]

 # 3. Train surrogate
 surr = Surrogate(proc, param_config, bounds, metrics, n_train=128)
 surr.train()

 # 4. Run sensitivity analysis
 surr.analyze_sensitivity(n_samples=1024)
 sobol_results = surr.sensitivity

 # 5. Selection of most important parameters, either based on a threshold or the number of parameters you want, and retrain model based on selection
 surr.select_important_params(threshold=0.05)
 surr.retrain()

 # 6. Set up latin hypercube sampler and run uncertainty quantification
 lhs_sampler = latin_hypercube_sampler(list(surr.bounds.values()))
 uq = perform_monte_carlo_uq(surrogate=surr, sample_input=lhs_sampler, metric=metrics[0], n_samples=1000)

 # 7. Visualize your analyses: sobol indices, uq distribution, and your results
uq_distribution(uq, metric="peak_width")

sobol_indices(sobol_results, metric=metrics[0])

summarize_results(
    surrogate=surr,
    metric=metrics[0],
    uq_result=uq,
)

Sensitivity Analysis Workflow Options

  • Option 1: Run Sensitivity Analysis First, Then Train Surrogate

    Use run_sensitivity_analysis on the CADET model to rank parameters, then train a surrogate focusing on the important ones (based on the number of parameters you’d like to retain, or on a threshold you can decide).

  • Option 2: Train Surrogate First, Then Run Sensitivity Analysis

    Fit a surrogate with Surrogate, then analyze it with analyze_sensitivity().

Both paths support uncertainty quantification and parameter calibration workflows.

All public functions include NumPy-style docstrings and Python 3.10+ type hints for autocompletion and static analysis.

📚 Documentation

Docs are hosted on GitHub Pages: https://talasunna.github.io/chromasurr/

🖇️ Project structure

chromasurr/
│   __init__.py
│   metrics.py              ← KPI extractor
│   sensitivity.py          ← Saltelli driver + helpers
│   surrogate.py            ← Surrogate manager
│   uq.py                   ← Uncertainty quantification tools
│   error_analysis.py       ← Error diagnostics
├── process/
│   └── batch_elution.py    ← Configurable CADET Process class
└── examples/
    └── chromasurr_demo.py  ← End-to-end demo script

docs/
tests/

📜 License

Distributed under the MIT License – see LICENSE for details.

Made with ☕ by Tala Al-Sunna.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chromasurr-0.1.0.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chromasurr-0.1.0-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file chromasurr-0.1.0.tar.gz.

File metadata

  • Download URL: chromasurr-0.1.0.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for chromasurr-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3155deab96337c5560b368ccf8cdc22bc25597d45a97670f770a4cf0308d9a33
MD5 18f27477c75a4737f20ea56dd74f4755
BLAKE2b-256 dcd7f706348534c6631804a127ca6086855b009369c50a0db078cfb3dd63d2c3

See more details on using hashes here.

File details

Details for the file chromasurr-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: chromasurr-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for chromasurr-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ead9b37c867bb105485f75f6c8859cb429f39702506dffb300897566e76a38f5
MD5 c3dfc935b17b2f74da17e0d719e9e936
BLAKE2b-256 2e0562178605fb173f6238a2d976cd000555e4874e7744538aec3b4b5764d870

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page