Skip to main content

A featherweight library to compute process capability metrics

Project description

Process Capability Metrics

A simple utility to calculate Process Capability (Cpk) metrics.

Installation

Standard Installation [Recommended]

Execute the following command in the terminal:

pip install cpkmetrics

NOTE: For macOS/Linux, use pip3 if needed.

The other options for installation are:

Installation/Run with uv

Click to expand

Install with the uv package manager (modern python tooling standard):

uv pip install cpkmetrics

Install From Source

Click to expand Clone this repo and install:
git clone https://github.com/your-username/cpkmetrics.git  # Replace with actual repo URL
cd cpkmetrics
python -m venv venv # Optically create virtual environment - not necessary given the lack of dependencies in this package
source venv/bin/activate # On Windows: .\venv\Scripts\activate (Ignore if you dont create a venv)
pip install -e .

Alternatively, you can also forgo installation and run directly by using the uv package manager's --with feature.

uv run --with cpkmetrics my_python_code.py 

Usage

A basic example calculating process capability metrics for a given mean, standard deviation and spec limits:

from cpkmetrics.process_capability import ProcessCapability

# Example values for mean, stddev, USL, and LSL
mean = 10
stddev = 1
USL = 14
LSL = 6

# Create an instance of the ProcessCapability class with the provided parameters. Instantiation also automatically prints results to the terminal (unless you pass print_results=False arg)
pc = ProcessCapability(mean, stddev, USL, LSL)

# You can also access individual items directly through the corrresponding property
cpk = pc.process_capability_index

print(f"The Cpk is {round(cpk, 2)}")
#OUTPUT: The Cpk is 1.33

Further examples can be found here including compatability with dataframes.

Roadmap

  • Skewness and Kurtosis metrics
  • Allow setting threshold values for Cpk and Cpa Ratings
  • Natural language results

Contributing

Contributions are encouraged and welcome. Please note that the intent of this package is to remain very light weight, with no dependencies. Bug fixes, refactors and raising issues are highly encouraged. Please align to the design and engineering practices below and create a PR for contributions.

Design and Engineering Practices

This project intends to have the smallest amount of code possible without sacrificing good design, structure and robust engineering practices that will allow future functionality, extensibility and forkability.

Documentation is copious - to maximize accessibility to AI/ML/SW engineers unfamiliar with statistical process control and for manufacturing/process/hardware engineers unfamiliar with python. Docstrings are detailed to allow for clarity as well as learning. In-line comments document code logic and design notes/decisions.

Project uses a modern toolchain to assist in this:

  • Project Management and Build: pyproject.toml compliant to PEP 751 though uv
  • Testing: pytest and coverage
  • Code Quality: Linting, Formatting through ruff Static Analysis through mypy. Enforced through pre-commmit and GitHub Actions
  • Documentation: Docstrings are enforced with interrogate at 90% threshold

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

cpkmetrics-0.1.0.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

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

cpkmetrics-0.1.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cpkmetrics-0.1.0.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.28

File hashes

Hashes for cpkmetrics-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4d567aa42afb6b35bc07e8daffd99a07acdab690cbc6d658d49aeefafff032dc
MD5 3213f33977581dfc6a3c90e7530373f8
BLAKE2b-256 119a1c0195d41b0986983339188696323790f53b06b682648d16d68d867ec382

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cpkmetrics-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.28

File hashes

Hashes for cpkmetrics-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df3522bf3066b0cb9da1c991156ea45f8e448d69dd7cc72a5aaf485c03bdca89
MD5 ce4811a6bbaa2b30f55cc2f3c53ffc72
BLAKE2b-256 4f7b18ff58ea08890eb5891809329d948552152a82910ddf451640799a83df40

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