Skip to content

Repository files navigation

CatLab-Tools 🔬

DOI Version Python License Streamlit License CI Open in Streamlit

ODS Calculation Suite — v3.5.5 Author: Hoda Jafari | MIT License


What is CatLab-Tools?

A Streamlit-based web application for oxidative desulfurization (ODS) kinetic analysis. Designed for PhD-level catalysis research — covers nonlinear kinetic fitting, activity metrics, residual diagnostics, Arrhenius analysis, and condition comparison.

Developed and validated for graphene-like metal-free catalysts derived from spent coffee grounds, covering thermal ODS, photocatalytic (PODS/UV), and electrochemical (ECODS) conditions.


🚀 Quick Start

git clone https://github.com/Hj1308/CatLab-Tools.git
cd CatLab-Tools
pip install -r requirements.txt
streamlit run app_ods.py

📑 Modules (Tabs)

Tab Module Description
1 Kinetic Fitting Fit 9 kinetic models, AICc model selection, k±SE, r₀, t½
2 Linearization Linear transforms (1/C vs t, ln(C₀/C) vs t) with best-model summary
3 Removal Efficiency Desulfurization efficiency (%) vs time + bar chart
4 TON / TOF Option A: site-based (metal catalysts) · Option B: mass-normalized (carbon-based)
5 Parameter Effect Simulate X%, k, t½ vs concentration, mass, temperature, O/S ratio
6 Oxidant Efficiency H₂O₂ utilisation efficiency (η%)
7 Condition Comparison Side-by-side k/t½/r₀ across conditions
8 Arrhenius Analysis Multi-temperature Ea & A with 95% confidence intervals
9 Residual Diagnostics Shapiro-Wilk, runs test, Q-Q plot, outlier detection

📐 Kinetic Models (Tab 1)

Best model selected automatically by AICc (small-sample corrected AIC) with parsimony rule. All models fitted by nonlinear least squares with C₀ locked.

Model Integrated Rate Law Class
Zero-order $C_t = C_0 - k_0 t$ $C_0 / (2k_0)$ Simplified
Pseudo-first-order $C_t = C_0, e^{-k_{app}t}$ $\ln 2 / k_{app}$ Simplified
Pseudo-second-order $C_t = C_0 / (1 + k_2 C_0 t)$ $1 / (k_2 C_0)$ Simplified
Elovich $C_t = C_0 - \frac{1}{\beta}\ln(1+\alpha\beta t)$ $(e^{C_0\beta/2}-1)/(\alpha\beta)$ Phenomenological
Langmuir-Hinshelwood $dC/dt = -k_{LH} K C / (1+KC)$ (ODE) $\ln2/(k_{LH}K) + C_0/(2k_{LH})$ Mechanistic
Power-Law $C_t = [C_0^{1-n} - k(1-n)t]^{1/(1-n)}$ analytical Empirical
Eley-Rideal $dC/dt = -k_{ER} K C$ (ODE, oxidant excess) Semi-mechanistic
Avrami $C_t = C_0 \exp(-k t^n)$ Phenomenological
Double-Exponential $C_t = C_0[A e^{-k_1 t} + (1-A)e^{-k_2 t}]$ Phenomenological

Eley-Rideal is structurally redundant here. This app measures only single-species data (sulfur concentration vs time), and the surface-reaction rate law is applied under excess-oxidant conditions (oxidant concentration is constant and folded into the rate constant — the standard assumption for liquid-phase ODS). Under that assumption the Eley-Rideal curve shape is already spanned by two existing models:

  • Low surface coverage — the adsorption isotherm is linear, $\theta_A \approx K_A C_A$ (constant), giving $dC/dt = -k,C$: mathematically identical to Pseudo-first-order.
  • General coverage$\theta_A = K_A C_A/(1 + K_A C_A)$ (constant), and the surface-reaction rate takes the rational form $C/(1+KC)$, i.e. exactly the Langmuir-Hinshelwood functional form implemented in this app.

No distinguishing curve shape is therefore obtainable from $C(t)$ alone, and the two fitted constants $k_{ER}$ and $K$ are only jointly identifiable (their product equals the Pseudo-first-order rate constant). Eley-Rideal is fit and displayed for completeness/comparison only (see the "All models" table) but is never eligible for automatic best-model selection (BEST_MODEL_EXCLUDE).

Auto-saturation detection: Tab 1 offers a user-adjustable fractional-uptake cutoff after Simonin (2016): any point whose removal exceeds a chosen fraction of the final/equilibrium removal value is excluded before fitting. Simonin originally proposed an 85% cutoff to reduce artificial pseudo-second-order dominance in simple two-model (PFO/PSO) adsorption studies.

Default = 1.0 (disabled). We empirically validated the cutoff against CatLab-Tools' full 9-model portfolio using synthetic ground-truth curves with genuine multi-point saturation tails (10 model archetypes × 15 noise seeds = 150 synthetic curves, ±3% removal noise, plateaus ending ~89%). In this broader model set the cutoff does not reduce false-PSO selection — it increases it (16.7% → 30.0% as the cutoff drops from 1.0 to 0.80) while degrading mechanistic-model recovery (Power-Law/L-H/Avrami) from 53.3% to 21.1%. The near-equilibrium tail is precisely the information those models need to be told apart from the flexible simplified models. Simonin's rationale applies where the candidate set contains only PFO/PSO; it does not transfer to a portfolio that also includes mechanistic ODE models. Kostoglou & Karapantsios (2022) reach the same conclusion for linearized PSO analysis generally.

Fractional-uptake cutoff Overall model recovery PSO/PFO recovery Mechanistic recovery (PL/LH/Avrami) False-PSO on mechanistic data
1.00 (disabled) 70.7% 96.7% 53.3% 16.7%
0.95 61.3% 98.3% 36.7% 22.2%
0.90 57.3% 98.3% 30.0% 26.7%
0.85 (Simonin) 52.0% 95.0% 23.3% 28.9%
0.80 51.3% 96.7% 21.1% 30.0%

Users studying pure adsorption kinetics with only PFO/PSO in play may manually lower the slider toward Simonin's original 0.85; see the discussion by Simonin (2016) and the broader pseudo-second-order critique of Kostoglou & Karapantsios (2022).

k ± SE and r₀

Standard Error from the curve_fit covariance matrix: $SE_k = \sqrt{[\Sigma]_{kk}}$

Initial reaction rate r₀:

Model r₀ formula
Zero-order $r_0 = k_0$
Pseudo-first-order $r_0 = k_{app} \cdot C_0$
Pseudo-second-order $r_0 = k_2 \cdot C_0^2$
Elovich $r_0 = \alpha$
L-H $r_0 = k_{LH} K C_0 / (1 + K C_0)$
Power-Law $r_0 = k \cdot C_0^n$

⚗️ TOF / TON (Tab 4)

Option A — Metal / Metal Oxide Catalysts (site-based)

TON = n_substrate_converted / n_active_sites     (dimensionless)
TOF (h⁻¹) = TON / t_reaction

Active site density from direct measurement (TPD/TPR/chemisorption) or BET + material-type presets.

Option B — Carbon-based / Metal-free Catalysts (mass-normalized)

For graphene-like, N/B-doped carbon, BCN, and similar materials, defining "active sites" is ambiguous. Mass-normalized TOF is the standard in the ODS literature for metal-free catalysts.

TOF_mass (mmol·g⁻¹·min⁻¹) = n_DBT_removed / (m_cat × t_reaction)
TOF_BET  (mmol·m⁻²·min⁻¹) = TOF_mass / BET_area

BET from Excel: Add a sheet named Catalyst_Properties to your data file:

Catalyst BET (m²/g) Notes
g-SiC 150 N₂ adsorption, 77 K
g-NSiC 250

The app reads BET values automatically and pre-fills the input fields.


🌡️ Arrhenius Analysis (Tab 8)

Upload one kinetic data file per temperature. The app fits each dataset, extracts k(T), then fits:

k(T) = A · exp(−Eₐ / RT)

Reports Eₐ and A with 95% confidence intervals.

⚠️ For L-H and Power-Law models, k is a composite parameter — Eₐ is apparent. Use a single fixed model (e.g. Pseudo-second-order) for a valid Arrhenius plot.


📦 Supported Units & Concentration Logic

ppmS vs ppm — Key Distinction

Feature ppmS ppm / mg/L
What is measured Mass of sulfur atom Mass of the pollutant molecule
MW used MW_S = 32.06 g/mol (auto-applied) MW of compound (e.g. DBT = 184.26 g/mol)
Default definition mg S / L fuel (volumetric) mg compound / L solution

ppmS Conversion (Volumetric default)

C₀ [mol/L] = C [mg S/L] / (MW_S [g/mol] × 10³)

Example: 250 ppmS → 250 / 32.06 / 1000 = 7.798 × 10⁻³ mol/L

Mass basis (advanced): For true mass fraction (mg S / kg fuel, e.g. XRF or ASTM D5453), switch to Mass basis in the sidebar — fuel density ρ (g/mL) is then applied.

Full Unit Support

Unit Conversion basis MW Required?
ppmS mg S / L fuel → mol/L via MW_S (volumetric default)
ppm / mg/L mg compound / L → mol/L via MW_compound
mmol/L Direct × 10⁻³
mol/L Direct
g/L ÷ MW_compound → mol/L

🧪 Example: ECODS Experimental Conditions

Parameter Value Unit
Initial sulfur concentration 250 ppmS (mg S / L fuel, volumetric)
Model solvent n-Heptane ρ = 0.684 g/mL
C₀ (mol/L) 7.798 × 10⁻³ 250 / 32.06 / 1000
O/S molar ratio 0.5

📄 Input File Format

Required columns in Raw_Data sheet:

  • Time (min) — reaction time
  • One or more catalyst columns: CatName Removal (%)

Optional sheet — Catalyst_Properties (for Tab 4 Option B):

  • Catalyst — must match catalyst column names
  • BET (m²/g) — BET surface area

Download the advanced template from Tab 1 to get a pre-filled Excel file.


🗂 Repository Structure

CatLab-Tools/
├── app_ods.py          # Main Streamlit app (v3.5.5)
├── requirements.txt    # numpy, pandas, matplotlib, scipy, openpyxl, streamlit
├── CHANGELOG.md        # Full version history
├── CITATION.cff        # Citation metadata (DOI: 10.5281/zenodo.21965745)
├── catlab/             # Core Python library modules
├── examples/           # Example datasets
├── tests/              # Unit tests
└── .github/            # GitHub Actions / workflows

📚 References

  1. Barghi, S.H. et al. ACS Omega 2025, 10, 15947. DOI: 10.1021/acsomega.4c06722
  2. Dhir, S. et al. J. Hazard. Mater. 2009, 161, 1360. DOI: 10.1016/j.jhazmat.2008.04.099
  3. Sengupta, A. et al. Ind. Eng. Chem. Res. 2012, 51, 147. DOI: 10.1021/ie2024068
  4. Safa, M. et al. Fuel 2019, 239, 24. DOI: 10.1016/j.fuel.2018.10.147
  5. Burnham, K.P.; Anderson, D.R. Model Selection and Multimodel Inference, 2nd ed.; Springer, 2002. (AICc criterion)
  6. Simonin, J.-P. Chem. Eng. J. 2016, 300, 254. DOI: 10.1016/j.cej.2016.04.079 (85% fractional-uptake cutoff to reduce artificial PSO dominance in PFO/PSO adsorption studies)
  7. Kostoglou, M.; Karapantsios, T.D. Colloids Interfaces 2022, 6, 55. DOI: 10.3390/colloids6040055 (broader critique of pseudo-second-order artifacts — why the cutoff does not transfer to a multi-model portfolio)
  8. Grzesik, M.; Szymonski, K. Ind. Eng. Chem. Res. 2021, 60, 8957. DOI: 10.1021/acs.iecr.1c01663 (comment on PSO misuse)

🔗 Related Repositories

Repo Purpose
BET_analyser BET, BJH, T-Plot, isotherm & hysteresis
EISForge EIS analysis + ML
sem-particle-analyzer SEM particle sizing
Raman-analysis Raman spectroscopy toolkit

Changelog

Version Key Changes
v3.5.3 Power-Law n>1 bug fix; Eley-Rideal excluded from auto-selection; Arrhenius composite-k warning; CSV auto-separator; Tab 4 Option B mass-normalized TOF for carbon catalysts
v3.5.2 Auto-saturation detection (8%/15% thresholds); per-catalyst point exclusion in Tab 1; linearized plots based on best model
v3.5.1 Power-Law numerical stability; Tab 8 savefig fix; model classification in assumptions
v3.5.0 ppmS volumetric default (no density); AICc model selection; Pseudo-second-order rename; residual diagnostics ddof fix
v3.4 Tab 8 Arrhenius multi-temperature; Tab 9 residual diagnostics
v3.3 L-H t½ analytical fix; centralised data loader; shared file uploader
v3.2 ppmS/ppm dual C₀ display; solvent selector; oxidant efficiency tab
v3.0 L-H model; k±SE; r₀; Power-Law; Eley-Rideal; Avrami; Double-Exponential

Full changelog: CHANGELOG.md


Cite This Software

If you use CatLab-Tools in your research, please cite:

Jafari, H. (2026). CatLab-Tools: ODS Calculation Suite (v3.5.5). Zenodo. DOI: 10.5281/zenodo.21965745


License

MIT License. See LICENSE for full terms.

Copyright (c) 2026 Hoda Jafari

About

ODS (oxidative desulfurization) kinetics suite — 9-model nonlinear fitting with AICc selection, TOF/TON, Arrhenius analysis with confidence intervals, and residual diagnostics, in a Streamlit app.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages