Enhancing Industrial Processes Improvement Cycle with Python (I): Introducing pyPETB’s Gage R&R Tool

Jose Garcia
4 min readJan 1, 2024

In the realm of industrial process improvement, the DMAIC (Define, Measure, Analyze, Improve, Control) cycle stands as a guiding framework. An indispensable facet of the “Measure” stage is the repeatability and reproducibility analysis— commonly known as Gage R&R. As a dedicated data analyst leveraging Python in my daily workflow, I encountered a gap in readily available tools for this crucial analysis. While ANOVA options were accessible, they often fell short of providing a comprehensive solution. Fueled by the need for a tool that seamlessly integrates with my workflow, I embarked on developing a feature within my own Python package, called pyPETB, and its first feature is specifically tailored for Gage R&R analysis.

Gage R&R ANOVA output

Integration with Pandas

Recognizing the ubiquity of data stored in CSV format, pyPETB’s Gage R&R functionality, encapsulated in pyPETB.RnRnumeric(), effortlessly consumes a Pandas DataFrame. This not only streamlines the data input process but also aligns with the simplicity of loading data from a CSV file.

In the spirit of accessibility and flexibility, the calculated Gage R&R model yields results in the form of Pandas DataFrames. This facilitates effortless access to individual values, enabling users to seamlessly integrate findings into subsequent analyses or craft tailored reports and visuals.

Pandas DataFrame getting the variance RnR result

Statistical Backbone with NumPy and SciPy

Underpinning the calculations essential for a comprehensive R&R analysis, pyPETB leverages the robust capabilities of NumPy and SciPy. From variance components to standard deviation contributions, every statistical nuance is meticulously computed, ensuring a thorough exploration of process variability source.

Versatility in Reporting

The utility of pyPETB’s Gage R&R extends beyond raw numbers. Users can opt for a concise summary graph that highlights discrepancies among different pieces and operators. Alternatively, a comprehensive report provides a holistic understanding of the current state of the measurement system, empowering users to make informed decisions.

RnR_Report() output example

Use Case Scenario: Unveiling Measurement Precision in 3D Printing

Imagine a scenario whithin the scope of 3D printing, where the accuracy of a 3D printer is under scrutiny after manufacturing 10 calibration cubes. These cubes are randomly distributed among three individuals, and each cube undergoes measurements using an old flexometer. Measurements are taken in an interleaved fashion, repeating the process three times for each cube. The goal is to assess the repeatability and reproducibility of the measurement process.

Step 1: Data Collection

from pypetb import RnR
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
#set seaborn style to improve the figure sight
sns.set()

# Load measurement dataset
url = 'https://raw.githubusercontent.com/jgherruzo/myFreeDatasets/main/Cal_Cub_Mea_Test1.csv' # noqa
df=pd.read_csv(url,sep=';')

Step 2: Initial Observations

#Build up the model
dict_key={'1':'Op','2':'Part','3':'Value'}
RnRModel=RnR.RnRNumeric(
mydf_Raw=df,
mydict_key=dict_key
)
#Solve it
RnRModel.RnRSolve()
call=RnRModel.RnR_Report()
plt.show()
Gage RnR initial Result

Step 4: Iterative Improvement

The result recommend check the gage. Use a flexometer to make the measurement increase the variability and make the measurement system unnaceptable. In order to improve it, a digital caliper will be used in the next step.

Digital Caliper

Repeat all the process using Cal_Cub_Mea_Test2.csv as data source:

Gage RnR 2nd iteration Result

The result is not as expected. The tool recommend to talk with our technician and after a short talk, it was discovered that one of them was writting the result as inches instead of mm. Root cause FOUNDED. Once this misundertsanding is solved, the process is repeated for Cal_Cub_Mea_Test3.csv

Final Gage RnR Result

After three iteration loop, it is found a correct measurement system.

Conclusion

In this real-world application of pyPETB’s Gage R&R tool, we navigated the nuances of measurement precision in a 3D printing process.

The case study underscored the importance of choosing an appropriate measuring instrument — a lesson learned through the contrast between an old flexometer and a digital caliper. As we strive for precision in industrial processes, pyPETB emerges as a pivotal companion, guiding users toward informed decisions and iterative improvements.

This articles born under my context, based on my reading, knowledge and experiences. I tryed to find the most efficient solution. If you know better ones or have ideas aboput how to improve it, feel free to share your thoughts¡

If you like this article, don’t forgot to claps and subscribe

Linkedin: https://www.linkedin.com/in/jos%C3%A9-garc%C3%ADa-herruzo-07032b50/

Github: https://jgherruzo.github.io/

--

--

Jose Garcia

Engineer, using different tools to get the best of each time. Optimizing industrial processes since 2011