Skip to main content

A professional engineering analytics and simulation toolkit for tolerance analysis, Monte Carlo simulation, and manufacturing variation.

Project description

tolerix ๐Ÿ”ง

Professional Engineering Analytics & Simulation Toolkit

Tolerix is a Python library for tolerance analysis, Monte Carlo simulation, and manufacturing variation analysis. It combines calculation, simulation, visualization, and intelligent engineering interpretation into one clean API.


Features

  • Shaft-hole fit analysis (clearance / interference / transition)
  • Monte Carlo tolerance simulation (up to 1M+ samples)
  • Probability of assembly failure
  • Engineering risk classification (LOW / MEDIUM / HIGH)
  • Intelligent warnings and recommendations
  • Professional dark-themed visualization
  • Clean, type-hinted, documented API

Installation

pip install tolerix

Quick Start

from tolerix import monte_carlo_fit
from tolerix.visualization import plot_fit_distribution

result = monte_carlo_fit(
    shaft=(20.00, 0.02),
    hole=(20.05, 0.01),
    samples=100_000,
    shaft_name="Motor Shaft",
    hole_name="Bearing Bore",
)

print(result.summary())
plot_fit_distribution(result)

Output

โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  TOLERIX โ€” Fit Analysis Report
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  Shaft       : Dimension('Motor Shaft' 20.0000 ยฑ 0.0200 mm [19.9800 โ€“ 20.0200])
  Hole        : Dimension('Bearing Bore' 20.0500 ยฑ 0.0100 mm [20.0400 โ€“ 20.0600])
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  Fit Type    : CLEARANCE FIT
  Clearance   : 100.0%
  Interference: 0.0%
  Mean Gap    : 0.0500 mm
  Std Dev     : 0.0075 mm
  Samples     : 100,000
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  Risk Level  : LOW
  Insight     : Tolerance range is stable for standard CNC manufacturing.
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

Real-World Scenarios

Scenario Fit Type Risk Clearance
Bearing Assembly CLEARANCE FIT LOW 100.0%
Gearbox Shaft TRANSITION FIT MEDIUM 95.2%
Press Fit Pin INTERFERENCE FIT HIGH 0.0%

API Reference

monte_carlo_fit

Runs a Monte Carlo simulation of shaft-hole fit variation.

Parameter Type Description
shaft tuple[float, float] (nominal, tolerance) in mm
hole tuple[float, float] (nominal, tolerance) in mm
samples int Number of simulation samples (default 100,000)
shaft_name str Optional label for shaft
hole_name str Optional label for hole
seed int or None Random seed for reproducibility

Returns a FitResult object.


FitResult.summary()

Returns a formatted multi-line engineering report string.


plot_fit_distribution

Generates a professional histogram of the clearance distribution.

Parameter Type Description
result FitResult Output from monte_carlo_fit()
bins int Histogram bins (default 80)
show bool Display plot window (default True)
save_path str or None Save figure to file path

License

MIT License โ€” see LICENSE file for details.


Author

Built with precision by Subiksha Thiyagarajan. Designed for real engineering, not toy examples.

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

tolerix-1.0.0.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

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

tolerix-1.0.0-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file tolerix-1.0.0.tar.gz.

File metadata

  • Download URL: tolerix-1.0.0.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for tolerix-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e0103e130d046623dc09a9598275dbbaca626d299dc347189f20bbc7bba2a171
MD5 dd2292076ba2f209cdb16f4857f0c305
BLAKE2b-256 ad804fb0f05076e111f5dbc7a696e3a2003be2e1b802dd86f2ab8a865be9bdb3

See more details on using hashes here.

File details

Details for the file tolerix-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: tolerix-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for tolerix-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6fcafe3af9d44974f722e8da3c3f7e3510dc9b4154f3b4bd413d933df70982e1
MD5 a4160be953cef631af5a2ebd3d5c0c75
BLAKE2b-256 0f09eac289c37bead717392853ee344eb2ebd22140a8fb8fc222d2f4fb3e8395

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