Skip to main content

pytolerance

🎯 Description

Python library designed for Tolerance Stack-up analysis using Monte Carlo simulation, allowing you to predict dimensional variability in mechanical assemblies. The dimension class also calculates absolute tolerances, enabling direct comparison with your Monte Carlo simulation results.

🚀 Key Features

Monte Carlo Simulation: Statistical precision for non-linear distributions. Distribution Support: Currently only supports Gausian distribution but is planned to include Uniform, Triangular ... Sensitivity Analysis: Identify which tolerances have the greatest impact on your results. Lightweight & Fast: Optimized for iterative calculations.

📦 Installation

pip install pytolerance

🛠️ Quick Start

📏 Define your dimensions

from pytolerance.dimension import Dimension

SAMPLES = 100000

dimension1 = Dimension(nominal=10,
                       tol_sup=0.5,
                       tol_inf=0,
                       CP=2,
                       number_samples=SAMPLES)

dimension2 = Dimension(nominal=11,
                       tol_sup=0,
                       tol_inf=-0.5,
                       CP=2,
                       number_samples=SAMPLES)

📊 Perform the operation

result = dimension1 - dimension2

📊 Visualize results

print(f"Mean: {result.mean:.4f} mm")
print(f"Sigma: {result.std:.4f} mm")

from pytolerance.hystogram import Hystogram

hist = Hystogram(
    dimension=result,
    bins=50,
    xlabel="Dimension (mm)",
    ylabel="Density",
    title="Distribution with Tolerance Limits"
)
hist.show_plot()

Sample of image to be shown

⚙️ Technical Requirements

Python 3.11

Main dependencies: numpy.

🤝 Contributing

To contribute to this project, please visit my GitHub repository: https://github.com/ErnestoAvedillo/tolerances/

📜 License

Copyright (c) 2026 Ernesto Avedillo Carretero

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytolerance-0.0.5.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

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

pytolerance-0.0.5-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file pytolerance-0.0.5.tar.gz.

File metadata

  • Download URL: pytolerance-0.0.5.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for pytolerance-0.0.5.tar.gz
Algorithm Hash digest
SHA256 f3f93be2120416915dbc07832faf83fb55d89e4b3c12747d11c64a3f4712e106
MD5 9d0dcb99bc62f59eb1fd8b5384ab0369
BLAKE2b-256 4e461c4b6f41063956db29f7b026180ced0492b17a0e36474818f0b36c3f1e83

See more details on using hashes here.

File details

Details for the file pytolerance-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: pytolerance-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for pytolerance-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f72003c898941d293870f8d2d4593f77ade5656db92f9a29a1491f91d1cc21f7
MD5 f8f1a5e0aadfed70569d9999fbe18190
BLAKE2b-256 0e2b5e2d405a1a4327e54663056470c6097dc2fb87cca916c893ca9d9b5bb994

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 files

0.0.2

2 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