Skip to main content

This is a tool to generate tolerance calculations

Project description

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 pytoleranceerance

🛠️ Quick Start

📏 Define your dimensions

from dimension import Dimension

SAMPLES = 100000

diemsion1 = 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 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.

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

pytolerance-0.0.2.tar.gz (17.4 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.2-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytolerance-0.0.2.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pytolerance-0.0.2.tar.gz
Algorithm Hash digest
SHA256 24d21d2f00eb13fbc5a4ec111a673415942f3056f2d588a65c9b20f533a74e6d
MD5 fb5876a3fed7e3e01a63a554bfd3d3c8
BLAKE2b-256 2d8af1a144016dbcb04d5baa084a2ec32ea9edcf9fed19123e9e3320ac5efe8a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytolerance-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pytolerance-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5d75862762fedb9cd9f34ef5846da584ecd3a335d64050170415c704b9bb0fbf
MD5 1e6b61632c6e58797911b41e924057af
BLAKE2b-256 59853759fb0097b694290d0aa87db811edec394aa7a82dc4cb9fc4dbbe1ba9c8

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