Skip to content

A simple sample size calculator to determine the samples needed per lot depending on the die size or the lead/bump count

Notifications You must be signed in to change notification settings

cerezoar/sample-size-calc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Sample Size Calculator

Description

This Python script, ss_calc.py, automates sample size selection based on either the Die Size or Lead Count method. It provides a simple command-line interface for users to input the necessary parameters and determine the appropriate sample size.

Features

  • Calculates sample size based on Die Size or Lead Count.
  • Input validation to ensure correct data types and prevent negative values.
  • Uses constants for sample sizes and thresholds to improve readability and maintainability.
  • Clear and concise output of the calculated sample size.

Usage

  1. Clone the repository:

    git clone <repository_url>
  2. Run the script:

    python ss_calc.py
  3. Follow the prompts:

    • Choose the method to determine sample size (Die Size or Lead Count).
    • Enter the required parameters (Die Size X and Y dimensions in mm, or Lead Count).
    • The script will display the calculated sample size.

Code Overview

ss_calc.py

  • get_sample_size_by_method(die_size_x_mm, die_size_y_mm, lead_count, method):
    • Calculates the sample size based on the chosen method and input values.
    • Performs input validation to ensure correct data types and prevent negative values.
    • Uses constants for sample sizes and thresholds.
    • Returns the calculated sample size or None if the input is invalid.
  • get_user_input(prompt, data_type):
    • Gets user input and validates the data type.
    • Prompts the user with the given message and attempts to convert the input to the specified data type.
    • Handles ValueError exceptions if the input cannot be converted to the specified data type.
  • Main loop:
    • Presents a menu to the user to choose the sample size determination method.
    • Gets the required input parameters from the user.
    • Calls the get_sample_size_by_method function to calculate the sample size.
    • Displays the calculated sample size to the user.

Constants

  • SS_77, SS_45, SS_32: Constants for sample sizes.
  • DIE_AREA_THRESHOLD_1, DIE_AREA_THRESHOLD_2: Constants for die area thresholds (in sq mm).
  • LEAD_COUNT_THRESHOLD_1, LEAD_COUNT_THRESHOLD_2: Constants for lead count thresholds.

Contributing

Contributions are welcome! Please feel free to submit pull requests with bug fixes, new features, or improvements to the documentation.

License

This project is licensed under the MIT License.

Author

Aldrin Cerezo

About

A simple sample size calculator to determine the samples needed per lot depending on the die size or the lead/bump count

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages