Skip to main content

PyCuDAL

Parametric acceptance limits for USP <905> Content Uniformity and USP <711> Dissolution.

PyCuDAL is a Python re-implementation of the CuDAL Version 2 SAS application (Bergum, 2007). For a user-specified coverage P (lower bound) and confidence level C, it constructs acceptance-limit tables such that meeting the limits assures any future sample from the batch will pass the applicable USP test at least P % of the time with C % confidence. It also evaluates those tables and computes lower confidence bounds on the probability of passing for observed samples.

CI PyPI License: MIT Release


Methods

Two sampling plans are supported for each test:

  • Plan 1 – one dosage unit per location (e.g. composite QC samples).
  • Plan 2 – an equal number of units (> 1) per location (e.g. process validation).

Three analyses are available per plan:

Analysis Description SAS equivalent
Acceptance-limit table Limits on the sample (mean/CV pairs, or LL/UL on the mean as a function of within- and between-location SD) CALCUSP1/2, CALDISP1/2
Probability of passing Probability that sample results fall inside a given table, for assumed true population parameters EVCUSP1/2, EVDISP1/2
Sample probability Lower confidence bound on the probability of passing, given observed sample results SMPCUSP1/2, SMPDISP1/2

Statistical details are given in docs/USER_MANUAL.md (Appendix B) and in the referenced publications.

Components

Component Entry point Notes
cudal library import cudal Modules cusp1, cusp2, disp1, disp2
CLI cudal, python -m cudal.cli Interactive (SAS-style) and sub-command interfaces
Tkinter GUI cudal-gui, python cudal_gui.py Standard-library UI; no extra dependencies
PySide6 GUI extras/cudal_gui_pyside6.py Optional Qt UI; not installed by default

Installation

Requires Python ≥ 3.9.

pip install .            # core: numpy, pandas, scipy + CLI + Tk GUI
pip install .[all]       # + matplotlib, reportlab, openpyxl
pip install .[qt]        # + PySide6 (optional Qt GUI)
pip install .[dev]       # + pytest, pyinstaller

Usage

Library

from cudal import cusp1

table = cusp1.acceptance_limit_table(10, 100.0, 95.0, 95.0, 85.1, 114.9, 0.5)
prob  = cusp1.probability_of_passing(table, 10, [95.0, 100.0], [1.0, 4.0])
bound = cusp1.sample_probability(100.0, 2.0, 10, 100.0, 95.0, 95.0)

CLI

cudal                                  # interactive SAS-style menu
cudal cusp1 -m evaluate -o ev.csv      # sub-command mode
cudal disp2 -m sample --mean 90 --se 2.2 --sm 2.46

GUI

cudal-gui                              # Tkinter
python extras/cudal_gui_pyside6.py     # PySide6 (requires pip install .[qt])

See docs/USER_MANUAL.md for a panel-by-panel guide.

Outputs and exports

  • Results tables (DataFrames) with sortable columns and conditional formatting.
  • CSV per table; XLSX workbook with one sheet per scenario.
  • PDF listings reproducing the SAS output format (Courier, wrapped column blocks, SE × SM LL/UL matrices, repeated page headers).
  • Plots: points with cubic-spline interpolation, or contour heatmaps with 80 %/90 % threshold contours; exportable as PNG.

Repository layout

cudal/        library: computations, CLI, Tk GUI, package data
extras/       optional PySide6 GUI (excluded from the wheel)
docs/         user manual
tests/        pytest smoke tests
scripts/      executable build helper
.github/      CI, PyPI publishing, release workflows

Testing

pip install -e .[all,dev]
pytest -q
python -m cudal.gui --selftest

References

  1. Bergum, J.S. (1990). Constructing Acceptance Limits for Multiple Stage Tests. Drug Development and Industrial Pharmacy, 16(14), 2153–2166.
  2. Bergum, J., Utter, M. (2000). Process Validation. In: Encyclopedia of Biopharmaceutical Statistics, Marcel Dekker, 422–439.
  3. Bergum, J.S., Utter, M.L. (2003). Statistical Methods for Uniformity and Dissolution Testing. In: Pharmaceutical Process Validation, Marcel Dekker, 667–697.
  4. Bergum, J., Li, H. (2007). Acceptance Limits for the New ICH USP 29 Content Uniformity Test. Pharmaceutical Technology, October, 88–98.
  5. Bergum, J. (2007). CuDAL Version 2 Users Guide and Appendix E – Lower Bound Calculations.

Acknowledgments

This project is a re-implementation of the CuDAL application originally designed, developed and validated in SAS by Dr. James Bergum. The statistical methods, program structure and reference outputs used here are due to his work; the original SAS programs and validation materials remain the authoritative source.

License

MIT. Provided as-is for research and informational use; it does not constitute regulatory advice. Validate against your own reference implementation before any GMP use.

Metadata

Release files for pycudal 1.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycudal 1.0.7
File Size Uploaded
pycudal-1.0.7.tar.gz 380.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pycudal 1.0.7
File Interpreter ABI Platform
pycudal-1.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 583.2 kB

Release files / pycudal-1.0.7.tar.gz

Download URL pycudal-1.0.7.tar.gz
Size 380.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0c42b0ca27b21eb67f8a1ed4f30e712c2b3acf4ce313a1ade8401653be1840e1
BLAKE2b-256 checksum
How to use checksums
2bb8b317fdebe65e4235afdcd03df6efa3fb47b24ec91556ed3efdf89b02f1cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / pycudal-1.0.7-py3-none-any.whl

Download URL pycudal-1.0.7-py3-none-any.whl
Size 202.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
99d1b3e0fab17fdee770216aea6fd88195c91a84092ce9b7815215545e6bb760
BLAKE2b-256 checksum
How to use checksums
ad3e989700eb37724b4d07235a72397ae3b3c31fda060c9331e1810f58101e20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

1.0.8

2 release files

This release

1.0.7 This release

2 release files

1.0.4

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page