Core

dimstack.dim

Basic

A measurement is a single measurement of a part.

Parameters:
  • nom (float) –

    The nominal value of the measurement. Defaults to 0.

  • tol (Bilateral) –

    The tolerance of the measurement. Defaults to Bilateral.symmetric(0).

  • a (float, default: 1 ) –

    The sensitivity of the measurement. Defaults to 1.

  • name (str, default: 'Dimension' ) –

    The name of the measurement. Defaults to "Dimension".

  • desc (str, default: 'Dimension' ) –

    The description of the measurement. Defaults to "Dimension".

rel_nominal: float property

The nominal value of the measurement. AKA, relative nominal

rel_median: float property

The median value of the measurement. AKA, relative median

rel_lower: float property

Relative lower value of the dimension

rel_upper: float property

Relative upper value of the dimension

abs_nominal: float property

The absolute nominal value of the measurement.

abs_median: float property

The absolute median value of the measurement.

abs_lower: float property

The minimum value of the measurement. AKA, absolute upper

abs_upper: float property

The maximum value of the measurement. AKA, absolute lower

abs_lower_tol: float property

The absolute minimum value of the tolerance.

abs_upper_tol: float property

The absolute maximum value of the tolerance.

convert_to_bilateral()

Convert the dimension to a bilateral dimension by centering the nominal value.

review(distribution=None)

Convert the dimension to a reviewed dimension.

Stack

append(measurement)

Append a measurement to the stack.

Reviewed

Reviewed

Parameters:
  • dim (Basic) –

    The basic dimension.

  • distribution (str, default: None ) –

    The distribution of the measurement. Defaults to "Normal".

C_p: float property

Process Capability

C_pk: float property

Process Capability Index

Z: float property

Z value

mean_eff: float property

effective mean

std_dev_eff: float property

effective standard deviation "6 std_dev" is the standard deviation of the distribution

process_sigma_eff: float property

calculated sigma (# of eff_std_devs away fromm USL and LSL)

k: float property

Shift (k) of the distribution

C_pk = C_p * (1 - k)

yield_loss_probability: float property

Returns the probability of a part being out of spec.

yield_probability: float property

Returns the probability of a part being in spec.

assume_normal_dist(target_process_sigma)

Assume a normal distribution.

assume_normal_dist_shifted(target_process_sigma, shift)

Assume a normal distribution with a shift

ReviewedStack

append(measurement)

Append a measurement to the stack.

to_basic_stack()

Convert the stack to a basic stack.

Requirement

median: float property

median

yield_loss_probability: float property

Returns the probability of a part being out of spec.

yield_probability: float property

Returns the probability of a part being in spec.

R: float property

Return the yield loss probability in PPM

dimstack.tolerance

Bilateral

Bilateral tolerancing is a method of specifying a tolerance that is symmetrical about the nominal value. This is the most common type of tolerancing.

upper property

Upper tolerance

lower property

Lower tolerance

T property

Total tolerance

symmetric(tol) classmethod

Create a bilateral tolerance with the same upper and lower bounds

asymmetric(upper, lower) classmethod

Create a bilateral tolerance with different upper and lower bounds

unequal(upper, lower) classmethod

Create a bilateral tolerance with different upper and lower bounds alias for asymmetric

dimstack.dist

Uniform

Uniform distribution.

Parameters:
  • lower (float) –

    Lower limit.

  • upper (float) –

    Upper limit.

Normal

Normal distribution.

Parameters:
  • mean (float) –

    Mean.

  • std_dev (float) –

    Standard deviation.

NormalScreened

Normal distribution which has been screened. e.g. Go-NoGo or Pass-Fail fixture.

Parameters:
  • mean (float) –

    Mean.

  • std_dev (float) –

    Standard deviation.

  • lower (float) –

    Lower limit.

  • upper (float) –

    Upper limit.

dimstack.calc

Closed(self)

This is a simple Closed calculation. This results in a Bilateral dimension with a tolerance that is the sum of the component tolerances. This is similar to WC but the nominal will be the sum of the component nominals.

WC(self)

This is a simple WC calculation. This results in a Bilateral dimension with a tolerance that is the sum of the component tolerances. This is similar to Closed but the nominal will be centered in the tolerance range A Worst-Case analysis ensures with any combination of tolerances, the combined stackup of tolerances will be within the this resulting tolerance.

RSS(self)

This is a simple RSS calculation. This is uses the RSS calculation method in the Dimensioning and Tolerancing Handbook, McGraw Hill. It is really only useful for a Bilateral stack of same process-std_dev dims. The RSS result has the same uncertainty as /the measurements. Historically, Eq. (9.11) assumed that all of the component tolerances (t_i) represent a 3sigma value for their manufacturing processes. Thus, if all the component distributions are assumed to be normal, then the probability that a dimension is between ±t_i is 99.73%. If this is true, then the assembly gap distribution is normal and the probability that it is ±t_rss between is 99.73%. Although most people have assumed a value of ±3s for piece-part tolerances, the RSS equation works for “equal s” values. If the designer assumed that the input tolerances were ±4s values for the piece-part manufacturing processes, then the probability that the assembly is between ±t_rss is 99.9937 (4s). The 3s process limits using the RSS Model are similar to the Worst Case Model. The minimum gap is equal to the mean value minus the RSS variation at the gap. The maximum gap is equal to the mean value plus the RSS variation at the gap.

See
  • Dimensioning and Tolerancing Handbook, McGraw Hill
  • http://files.engineering.com/getfile.aspx?folder=69759f43-e81a-4801-9090-a0c95402bfc0&file=RSS_explanation.GIF
Returns:
  • Basic( Basic ) –

    A Bilateral dimension with the RSS tolerance of the stack.

MRSS(self)

Basically RSS with a coefficient modifier to make the tolerance tighter.

Returns:
  • Basic( Basic ) –

    A Bilateral dimension with the MRSS tolerance of the stack.

SixSigma(self, at=3)

"6 Sigma" calculation of a Dimension stackup with distribution information of each. This results in a Reviewed dimension with a tolerance that is the sum of the component tolerances. The "6 Sigma" Analysis is a common method for determining the resulting distribution of a sum of distributions.

dimstack.stats

C_p(UL, LL, std_dev)

Process capability index.

Parameters:
  • UL (int) –

    Upper limit.

  • LL (int) –

    Lower limit.

  • sigma (int) –

    Standard deviation.

Returns:
  • float( float ) –

    Process capability index.

C_p(1, 0, 1) 0.16666666666666666 C_p(6, -6, 1) 2.0

C_pk(UL, LL, mean, std_dev)

Process capability index. adjusted for centering. Cpl = (mu - L)/3std_dev Cpu = (U - mu)/3std_dev C_pk = min(Cpl, Cpu) = (1 - k) * C_p

Parameters:
  • UL (float) –

    Upper limit.

  • LL (float) –

    Lower limit.

  • std_dev (float) –

    Standard deviation.

  • mean (float) –

    Mean.

Returns:
  • float( float ) –

    Process capability index.

from .utils import nround nround(C_pk(208.036, 207.964, 208.009, 0.006)) 1.5

rss_args(*args)

Root sum square.

rss_args(1, 2, 3) 3.7416573867739413

rss(args)

Root sum square.

rss([1, 2, 3]) 3.7416573867739413

C_f(t_rss, t_wc, n)

Correction factor used to calculate the modified RSS.

Parameters:
  • t_rss (_type_) –

    description

  • t_wc (_type_) –

    description

  • n (_type_) –

    description

Returns:
  • _type_

    description

normal_cdf(x, mean=0, std_dev=1)

Cumulative distribution function for the normal distribution.

normal_cdf(0) 0.5 normal_cdf(1) 0.8413447460685428 normal_cdf(2) 0.9772498680518209

dimstack.utils

nround(number, ndigits=DECIMALS)

Always round off

nround(4.114, 2) 4.11 nround(4.115, 2) 4.12 nround(4.116, 2) 4.12 nround(-0.03401, 3) -0.034

sign(x)

Return the sign of x, i.e. -1, 0 or 1.

sign(0) 0 sign(10) 1 sign(-10) -1

sign_symbol(x)

Return the sign of x, i.e. + or -.

sign_symbol(0) '+' sign_symbol(10) '+' sign_symbol(-10) '-'

Returns:
  • string

    "+", "-"