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.1.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.1-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: chromasurr-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 d013a1df53f49f6de1db29fe7aa50ef9cea564321996ba0dab313894e1fa327d
MD5 61b5d0654ce0afb4100588874b5dba97
BLAKE2b-256 ae0ffa726a4a4d33c013a8eb899714f1edb2d9057af7b5f7455b1227982ff2b2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chromasurr-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fb1deb9ab15bda192e1f3722f10afe1bc7f29cea6cef3ee9123a1e419c7a7641
MD5 9beeb629cc4880f3ea6aed51832531ed
BLAKE2b-256 7faf2c7f6a2984ea07ea7aee9d9653eabe75dc4802a82efd655a75f92a69a83a

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