Name,Kind,CL Color,Script,Group
"Box and Whisker LCL","44","java.awt.Color[r=255,g=200,b=0]","",""
"Box and Whisker UCL","43","java.awt.Color[r=255,g=200,b=0]","",""
"Cp LSL","38","java.awt.Color[r=255,g=200,b=0]","",""
"Cp Target","39","java.awt.Color[r=255,g=200,b=0]","",""
"Cp USL","37","java.awt.Color[r=255,g=200,b=0]","",""
"CpPp LSL","47","java.awt.Color[r=255,g=200,b=0]","",""
"CpPp Target","48","java.awt.Color[r=255,g=200,b=0]","",""
"CpPp USL","46","java.awt.Color[r=255,g=200,b=0]","",""
"Histogram LCL","29","java.awt.Color[r=255,g=200,b=0]","",""
"Histogram UCL","28","java.awt.Color[r=255,g=200,b=0]","",""
"Individual LCL","11","java.awt.Color[r=255,g=200,b=0]","#Individual LCL Calculation\n#Get the SPC data that the Individual LCL will be calculated for\nds = event.getData()\n\n#Get the columnn index within the SPC data\nxBarColNdx = ds.getColumnIndex(\"XBar\")\nmrColNdx = ds.getColumnIndex(\"MR\")\n\n#Initialize XBar and moving range sums that are need to calculate average Xbar and moving range.\nxBarSum = 0.0\nmrSum = 0.0\n\n#Cycle through each row and add to the sum\nfor row in range(ds.rowCount):\n\txBarSum = xBarSum + ds.getValueAt(row, xBarColNdx)\n\tmrVal = ds.getValueAt(row, mrColNdx)\n\tif mrVal <> None:\n\t\tmrSum = mrSum + mrVal\n\n#Calculate the average XBar and moving range\nxDBar = xBarSum / ds.rowCount\t\t\nmrBar = mrSum / (ds.rowCount - 1)\n\t\n#Calculate the Individual LCL\nlcl = xDBar - 2.66 * mrBar\n\n#Return the new Individual LCL back to the SPC module\nevent.setControlLimitValue(lcl)",""
"Individual UCL","10","java.awt.Color[r=255,g=200,b=0]","#Individual UCL Calculation\n#Get the SPC data that the Individual UCL will be calculated for\nds = event.getData()\n\n#Get the columnn index within the SPC data\nxBarColNdx = ds.getColumnIndex(\"XBar\")\nmrColNdx = ds.getColumnIndex(\"MR\")\n\n#Initialize XBar and moving range sums that are need to calculate average Xbar and moving range.\nxBarSum = 0.0\nmrSum = 0.0\n\n#Cycle through each row and add to the sum\nfor row in range(ds.rowCount):\n\txBarSum = xBarSum + ds.getValueAt(row, xBarColNdx)\n\tmrVal = ds.getValueAt(row, mrColNdx)\n\tif mrVal <> None:\n\t\tmrSum = mrSum + mrVal\n\n#Calculate the average XBar and moving range\nxDBar = xBarSum / ds.rowCount\t\t\nmrBar = mrSum / (ds.rowCount - 1)\n\t\n#Calculate the Individual UCL\nucl = xDBar + 2.66 * mrBar\n\n#Return the new Individual UCL back to the SPC module\nevent.setControlLimitValue(ucl)",""
"MR LCL","35","java.awt.Color[r=255,g=200,b=0]","#Moving Range LCL Calculation\n#The LCL for Moving Range is always 0\nlcl = 0.0\n\n#Return the new Moving Range LCL back to the SPC module\nevent.setControlLimitValue(lcl)",""
"MR UCL","34","java.awt.Color[r=255,g=200,b=0]","#Moving Range UCL Calculation\n#Get the SPC data that the Moving Range UCL will be calculated for\nds = event.getData()\n\n#Get the columnn index within the SPC data\nmrColNdx = ds.getColumnIndex(\"MR\")\n\n#Initialize moving range sums that are need to calculate average moving range.\nmrSum = 0.0\n\n#Cycle through each row and add to the sum\nfor row in range(ds.rowCount):\n\tmrSum = mrSum + ds.getValueAt(row, mrColNdx)\n\n#Calculate the average moving range\nmrBar = mrSum / (ds.rowCount - 1)\n\t\n#Calculate the Moving Range UCL\nucl = 3.267 * mrBar\n\n#Return the new Moving Range UCL back to the SPC module\nevent.setControlLimitValue(ucl)",""
"Median LCL","14","java.awt.Color[r=255,g=200,b=0]","#XBar LCL Calculation\n#Define the A2 factors array.\n#The A2 factors correspond to the sample size which starts at 2.\n#THis is why element 0 and 1 of the array are 0.\na2 = [0.0, 0.0, 1.880, 1.023, 0.729, 0.577, 0.483, 0.419, 0.373, 0.337, 0.308, 0.285, 0.266, 0.249, 0.235, 0.223, 0.212, 0.203, 0.194, 0.187, 0.180, 0.173, 0.167, 0.162, 0.157, 0.153]\n\n#Get the SPC data that the Median LCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \nmedianColNdx = ds.getColumnIndex(\"Median\")\nrangeColNdx = ds.getColumnIndex(\"Range\")\n\n#Initialize xBar and range sums that are need to calculate average xBar and range. \nmedianSum = 0.0\nrSum = 0.0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tmedianSum = medianSum + ds.getValueAt(row, medianColNdx)\n\trSum = rSum + ds.getValueAt(row, rangeColNdx)\n\n#Calculate the average xBar and range\t\nmedianBar = medianSum / ds.rowCount\nrBar = rSum / ds.rowCount\n\n#Get the sample size.\nsampleSize = event.getSampleSize()\n\n#Lookup the A2 value\nif sampleSize < len(a2):\n\ta2Value = a2[sampleSize]\nelse:\n\ta2Value = a2[len(a2) - 1]\n\t\n#Calculate the Median LCL\nlcl = medianBar - a2Value * rBar\n\n#Return the new Median LCL back to the SPC module\nevent.setControlLimitValue(lcl)",""
"Median UCL","13","java.awt.Color[r=255,g=200,b=0]","#XBar UCL Calculation\n#Define the A2 factors array.\n#The A2 factors correspond to the sample size which starts at 2.\n#THis is why element 0 and 1 of the array are 0.\na2 = [0.0, 0.0, 1.880, 1.023, 0.729, 0.577, 0.483, 0.419, 0.373, 0.337, 0.308, 0.285, 0.266, 0.249, 0.235, 0.223, 0.212, 0.203, 0.194, 0.187, 0.180, 0.173, 0.167, 0.162, 0.157, 0.153]\n\n#Get the SPC data that the Median UCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \nmedianColNdx = ds.getColumnIndex(\"Median\")\nrangeColNdx = ds.getColumnIndex(\"Range\")\n\n#Initialize xBar and range sums that are need to calculate average xBar and range. \nmedianSum = 0.0\nrSum = 0.0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tmedianSum = medianSum + ds.getValueAt(row, medianColNdx)\n\trSum = rSum + ds.getValueAt(row, rangeColNdx)\n\n#Calculate the average xBar and range\t\nmedianBar = medianSum / ds.rowCount\nrBar = rSum / ds.rowCount\n\n#Get the sample size.\nsampleSize = event.getSampleSize()\n\n#Lookup the A2 value\nif sampleSize < len(a2):\n\ta2Value = a2[sampleSize]\nelse:\n\ta2Value = a2[len(a2) - 1]\n\t\n#Calculate the Median UCL\nlcl = medianBar + a2Value * rBar\n\n#Return the new Median UCL back to the SPC module\nevent.setControlLimitValue(lcl)",""
"Pp LSL","41","java.awt.Color[r=255,g=200,b=0]","",""
"Pp Target","42","java.awt.Color[r=255,g=200,b=0]","",""
"Pp USL","40","java.awt.Color[r=255,g=200,b=0]","",""
"Range LCL","5","java.awt.Color[r=255,g=200,b=0]","#Range UCL Calculation\n#Define the D3 factors array.\n#The D3 factors correspond to the sample size which starts at 7 for Range LCL.\n#This is why element 0 through 6 of the array are 0.\nd3 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.076, 0.136, 0.184, 0.223, 0.256, 0.283, 0.307, 0.328, 0.347, 0.363, 0.378, 0.391, 0.403, 0.415, 0.425, 0.434, 0.443, 0.451, 0.459]\n\n#Get the SPC data that the Range LCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexe within the SPC data\nrangeColNdx = ds.getColumnIndex(\"Range\")\n\n#Initialize range sum that are need to calculate average range.\nrSum = 0.0\n\n#Cycle through each row and add to the sum\nfor row in range(ds.rowCount):\n\tr = ds.getValueAt(row, rangeColNdx)\n\trSum = rSum + r\n\n#Calculate the average range\t\t\nrBar = rSum / ds.rowCount\n\n#Get the sample size.\nsampleSize = event.getSampleSize()\n\n#Lookup the D3 value\nif sampleSize < len(d3):\n\td3Value = d3[sampleSize]\nelse:\n\td3Value = d3[len(d3) - 1]\n\t\n#Calculate the Range LCL\nlcl = d3Value * rBar\n\n#Return the new Range LCL back to the SPC module\nevent.setControlLimitValue(lcl)",""
"Range UCL","4","java.awt.Color[r=255,g=200,b=0]","#Range UCL Calculation\n#Define the D4 factors array.\n#The D4 factors correspond to the sample size which starts at 2.\n#This is why element 0 and 1 of the array are 0. \nd4 = [0.0, 0.0, 3.267, 2.574, 2.282, 2.114, 2.004, 1.924]\n\n#Get the SPC data that the Range UCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexe within the SPC data\nrangeColNdx = ds.getColumnIndex(\"Range\")\n\n#Initialize range sum that are need to calculate average range.\nrSum = 0.0\n\n#Cycle through each row and add to the sum\nfor row in range(ds.rowCount):\n\tr = ds.getValueAt(row, rangeColNdx)\n\trSum = rSum + r\n\n#Calculate the average range\t\nrBar = rSum / ds.rowCount\n\n#Get the sample size.\nsampleSize = event.getSampleSize()\n\n#Lookup the D3 value\nif sampleSize < len(d4):\n\td4Value = d4[sampleSize]\nelse:\n\td4Value = d4[len(d4) - 1]\n\t\n#Calculate the Range UCL\nucl = d4Value * rBar\n\n#Return the new Range UCL back to the SPC module\nevent.setControlLimitValue(ucl)",""
"StdDev LCL","8","java.awt.Color[r=255,g=200,b=0]","#Standard Deviation LCL Calculation\n#Define the B3 factors array.\n#The B3 factors correspond to the sample size which starts at 6.\n#This is why element 0 through 5 of the array are 0.\nb3 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.030, 0.118, 0.185, 0.239, 0.284, 0.321, 0.354, 0.382, 0.406, 0.428, 0.448, 0.466, 0.482, 0.497, 0.510, 0.523, 0.534, 0.545, 0.555, 0.565]\n\n#Get the SPC data that the StdDev LCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \nsBarColNdx = ds.getColumnIndex(\"SBar\")\n\n#Initialize StdDev sum that are need to calculate average StdDev. \nsSum = 0.0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tsSum = sSum + ds.getValueAt(0, sBarColNdx)\n\n#Calculate the average StdDev\t\nsBar = sSum / ds.rowCount\n\t\t\n#Get the sample size.\t\nsampleSize = event.getSampleSize()\n\n#Lookup the B3 value\nif sampleSize < len(b3):\n\tb3Value = b3[sampleSize]\nelse:\n\tb3Value = b3[len(b3) - 1]\n\n#Calculate the StdDev LCL\t\nlcl = sBar * b3Value\n\n#Return the new StdDev LCL back to the SPC module\nevent.setControlLimitValue(lcl)",""
"StdDev UCL","7","java.awt.Color[r=255,g=200,b=0]","#Standard Deviation UCL Calculation\n#Define the B4 factors array.\n#The B4 factors correspond to the sample size which starts at 6.\n#This is why element 0 through 5 of the array are 0.\nb4 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.970, 1.882, 1.815, 1.761, 1.716, 1.679, 1.646, 1.618, 1.594, 1.572, 1.552, 1.534, 1.518, 1.503, 1.490, 1.477, 1.466, 1.455, 1.445, 1.435]\n\n#Get the SPC data that the StdDev UCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \nsBarColNdx = ds.getColumnIndex(\"SBar\")\n\n#Initialize StdDev sum that are need to calculate average StdDev. \nsSum = 0.0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tsSum = sSum + ds.getValueAt(0, sBarColNdx)\n\n#Calculate the average StdDev\t\nsBar = sSum / ds.rowCount\n\t\t\n#Get the sample size.\t\nsampleSize = event.getSampleSize()\n\n#Lookup the B4 value\nif sampleSize < len(b4):\n\tb4Value = b4[sampleSize]\nelse:\n\tb4Value = b4[len(b4) - 1]\n\n#Calculate the StdDev UCL\t\nucl = sBar * b4Value\n\n#Return the new StdDev UCL back to the SPC module\nevent.setControlLimitValue(ucl)",""
"XBar LCL","2","java.awt.Color[r=255,g=200,b=0]","#XBar LCL Calculation\n#Define the A2 factors array.\n#The A2 factors correspond to the sample size which starts at 2.\n#This is why element 0 and 1 of the array are 0.\na2 = [0.0, 0.0, 1.880, 1.023, 0.729, 0.577, 0.483, 0.419, 0.373, 0.337, 0.308, 0.285, 0.266, 0.249, 0.235, 0.223, 0.212, 0.203, 0.194, 0.187, 0.180, 0.173, 0.167, 0.162, 0.157, 0.153]\n\n#Get the SPC data that the XBar LCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \nxBarColNdx = ds.getColumnIndex(\"XBar\")\nrangeColNdx = ds.getColumnIndex(\"Range\")\n\n#Initialize xBar and range sums that are need to calculate average xBar and range. \nxBarSum = 0.0\nrSum = 0.0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\txBarSum = xBarSum + ds.getValueAt(row, xBarColNdx)\n\trSum = rSum + ds.getValueAt(row, rangeColNdx)\n\n#Calculate the average xBar and range\t\nxDBar = xBarSum / ds.rowCount\nrBar = rSum / ds.rowCount\n\n#Get the sample size.\nsampleSize = event.getSampleSize()\n\n#Lookup the A2 value\nif sampleSize < len(a2):\n\ta2Value = a2[sampleSize]\nelse:\n\ta2Value = a2[len(a2) - 1]\n\t\n#Calculate the xBar LCL\nlcl = xDBar - a2Value * rBar\n\n#Return the new xBar LCL back to the SPC module\nevent.setControlLimitValue(lcl)",""
"XBar LSL","3","java.awt.Color[r=255,g=200,b=0]","",""
"XBar UCL","1","java.awt.Color[r=255,g=200,b=0]","#XBar UCL Calculation\n#Define the A2 factors array.\n#The A2 factors correspond to the sample size which starts at 2.\n#This is why element 0 and 1 of the array are 0. \na2 = [0.0, 0.0, 1.880, 1.023, 0.729, 0.577, 0.483, 0.419, 0.373, 0.337, 0.308, 0.285, 0.266, 0.249, 0.235, 0.223, 0.212, 0.203, 0.194, 0.187, 0.180, 0.173, 0.167, 0.162, 0.157, 0.153]\n\n#Get the SPC data that the XBar UCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \nxBarColNdx = ds.getColumnIndex(\"XBar\")\nrangeColNdx = ds.getColumnIndex(\"Range\")\n\n#Initialize xBar and range sums that are need to calculate average xBar and range. \nxBarSum = 0.0\nrSum = 0.0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\txBarSum = xBarSum + ds.getValueAt(row, xBarColNdx)\n\trSum = rSum + ds.getValueAt(row, rangeColNdx)\n\t\n#Calculate the average xBar and range\nxDBar = xBarSum / ds.rowCount\nrBar = rSum / ds.rowCount\n\n#Get the sample size.\nsampleSize = event.getSampleSize()\n\n#Lookup the A2 value\nif sampleSize < len(a2):\n\ta2Value = a2[sampleSize]\nelse:\n\ta2Value = a2[len(a2) - 1]\n\t\n#Calculate the xBar UCL\nucl = xDBar + a2Value * rBar\n\n#Return the new xBar UCL back to the SPC module\nevent.setControlLimitValue(ucl)",""
"XBar USL","3","java.awt.Color[r=255,g=200,b=0]","",""
"c LCL","23","java.awt.Color[r=255,g=200,b=0]","#c LCL Calculation\nimport math\n\n#Get the SPC data that the c LCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \nnonconformitiesColNdx = ds.getColumnIndex(\"Total Nonconformities\")\n\n#Initialize nonconforming sums that are need to calculate np. \nnonconformitiesSum = 0.0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tnonconformitiesSum = nonconformitiesSum + ds.getValueAt(row, nonconformitiesColNdx)\n\t\t\n#Calculate the average np\ncBar = nonconformitiesSum / ds.rowCount\n\n#Calculate 3 sigma value\nsigma3 = 3 * math.sqrt(cBar)\n\n#Calculate the c LCL\nlcl = cBar - sigma3\nif lcl < 0:\n\tlcl = 0\n#Return the new c LCL back to the SPC module\nevent.setControlLimitValue(lcl)",""
"c UCL","22","java.awt.Color[r=255,g=200,b=0]","#c UCL Calculation\nimport math\n\n#Get the SPC data that the c UCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \nnonconformitiesColNdx = ds.getColumnIndex(\"Total Nonconformities\")\n\n#Initialize nonconforming sums that are need to calculate np. \nnonconformitiesSum = 0.0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tnonconformitiesSum = nonconformitiesSum + ds.getValueAt(row, nonconformitiesColNdx)\n\t\t\n#Calculate the average np\ncBar = nonconformitiesSum / ds.rowCount\n\n#Calculate 3 sigma value\nsigma3 = 3 * math.sqrt(cBar)\n\n#Calculate the c UCL\nucl = cBar + sigma3\n#Return the new c UCL back to the SPC module\nevent.setControlLimitValue(ucl)\n",""
"np LCL","20","java.awt.Color[r=255,g=200,b=0]","#np LCL Calculation\nimport system\nimport math\n\n#Get the SPC data that the np LCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \nnonconformingColNdx = ds.getColumnIndex(\"Total Nonconforming\")\n\n#Initialize nonconforming sums that are need to calculate np. \nnonconformingSum = 0.0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tnonconformingSum = nonconformingSum + ds.getValueAt(row, nonconformingColNdx)\n\t\t\n#Calculate the average np\nnpBar = nonconformingSum / ds.rowCount\n\n#Get the sample size.\nsampleSize = ds.getValueAt(row, \"InspectedCount\")\n\n#Calculate 3 sigma value\npBar = npBar / sampleSize\nsigma3 = 3 * math.sqrt(npBar * (1 - pBar))\n\n#Calculate the np LCL\nlcl = npBar - sigma3\nif lcl < 0:\n\tlcl = 0\n\t\n#Return the new np LCL back to the SPC module\nevent.setControlLimitValue(lcl)\n",""
"np UCL","19","java.awt.Color[r=255,g=200,b=0]","#np UCL Calculation\nimport math\n\n#Get the SPC data that the np UCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \nnonconformingColNdx = ds.getColumnIndex(\"Total Nonconforming\")\n\n#Initialize nonconforming sums that are need to calculate np. \nnonconformingSum = 0.0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tnonconformingSum = nonconformingSum + ds.getValueAt(row, nonconformingColNdx)\n\t\t\n#Calculate the average np\nnpBar = nonconformingSum / ds.rowCount\n\n#Get the sample size.\nsampleSize = ds.getValueAt(row, \"InspectedCount\")\n\n#Calculate 3 sigma value\npBar = npBar / sampleSize\nsigma3 = 3 * math.sqrt(npBar * (1 - pBar))\n\n#Calculate the np UCL\nucl = npBar + sigma3\n#Return the new np UCL back to the SPC module\nevent.setControlLimitValue(ucl)\n",""
"p LCL","17","java.awt.Color[r=255,g=200,b=0]","#p LCL Calculation\nimport system\nimport math\n\n#Get the SPC data that the p LCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \ninspectedColNdx = ds.getColumnIndex(\"InspectedCount\")\nnonconformingColNdx = ds.getColumnIndex(\"Total Nonconforming\")\n\n#Initialize inspected and nonconforming sums that are need to calculate p. \ninspectedSum = 0.0\nnonconformingSum = 0.0\n\n#Track the max and min of inspected items during the samplings \nminSampleSize = 9999999\nmaxSampleSize = 0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tinspCnt = ds.getValueAt(row, inspectedColNdx)\n\tinspectedSum = inspectedSum + inspCnt\n\tnonconformingSum = nonconformingSum + ds.getValueAt(row, nonconformingColNdx)\n\tif inspCnt < minSampleSize:\n\t\tminSampleSize = inspCnt\n\tif inspCnt > maxSampleSize:\n\t\tmaxSampleSize = inspCnt\t\n\t\n#Calculate the average p\npBar = nonconformingSum / inspectedSum\n\n#Determine the variation in sample size.\nvariation = (maxSampleSize - minSampleSize) / maxSampleSize;\n\n#If the sample size variation is less than 20%, then use the average sample size else use the min sample size\nif variation < 0.20:\n\tavgSampleSize = inspectedSum / ds.rowCount\n\t#Calculate 3 sigma value\n\tsigma3 = 3 * math.sqrt(pBar * (1 - pBar) / avgSampleSize)\n\t#Calculate the p LCL\n\tlcl = pBar - sigma3\n\t#Return the new p LCL back to the SPC module\n\tevent.setControlLimitValue(lcl)\nelse:\n\t#Calculate Outer LCL value based on the min sample size\n\touterSigma3 = 3 * math.sqrt(pBar * (1 - pBar) / minSampleSize)\n\touterLCL = pBar - outerSigma3\n\t\n\t#Calculate Inner LCL value based on the max sample size\n\tinnerSigma3 = 3 * math.sqrt(pBar * (1 - pBar) / maxSampleSize)\n\tinnerLCL = pBar - innerSigma3\n\n\t#Get the columnn indexes within the SPC data \n\tpColNdx = ds.getColumnIndex(\"p\")\n\tpLCLColNdx = ds.getColumnIndex(\"p LCL\")\n\t\n\t#Cycle through all points again\n\tfor row in range(ds.rowCount):\n\t\tp = ds.getValueAt(row, pColNdx)\n\t\tif p > innerLCL and p < outerLCL:\n\t\t\t#Because the point is between the inner and outer limits, calculate the exact limits for this point\n\t\t\tinspCnt = ds.getValueAt(row, inspectedColNdx)\n\t\t\tpLCL = p - 3 * math.sqrt(p * (1 - p) / inspCnt)\n\t\t\t#Save it back to the SPC data for this point\n\t\t\tevent.setValue(row, pLCLColNdx, pLCL)\n\t\telse:\n\t\t\t#Otherwise, just use the outer limit\n\t\t\tevent.setValue(row, pLCLColNdx, outerLCL)\n\t\t\t\t\t\t\n\t#Return the new p LCL back to the SPC module\n\tevent.setControlLimitValue(outerLCL)\t\t\t\n",""
"p UCL","16","java.awt.Color[r=255,g=200,b=0]","#p UCL Calculation\nimport math\n\n#Get the SPC data that the p UCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \ninspectedColNdx = ds.getColumnIndex(\"InspectedCount\")\nnonconformingColNdx = ds.getColumnIndex(\"Total Nonconforming\")\n\n#Initialize inspected and nonconforming sums that are need to calculate p. \ninspectedSum = 0.0\nnonconformingSum = 0.0\n\n#Track the max and min of inspected items during the samplings \nminSampleSize = 9999999\nmaxSampleSize = 0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tinspCnt = ds.getValueAt(row, inspectedColNdx)\n\tinspectedSum = inspectedSum + inspCnt\n\tnonconformingSum = nonconformingSum + ds.getValueAt(row, nonconformingColNdx)\n\tif inspCnt < minSampleSize:\n\t\tminSampleSize = inspCnt\n\tif inspCnt > maxSampleSize:\n\t\tmaxSampleSize = inspCnt\t\n\t\n#Calculate the average p\npBar = nonconformingSum / inspectedSum * 100.0\n\n#Determine the variation in sample size.\nvariation = (maxSampleSize - minSampleSize) / maxSampleSize;\n\n#If the sample size variation is less than 20%, then use the average sample size else use the min sample size\nif variation < 0.20:\n\tavgSampleSize = inspectedSum / ds.rowCount\n\t#Calculate 3 sigma value\n\tsigma3 = 3 * math.sqrt(pBar * (100.0 - pBar) / avgSampleSize)\n\t#Calculate the p UCL\n\tucl = pBar + sigma3\n\t#Return the new p UCL back to the SPC module\n\tevent.setControlLimitValue(ucl)\nelse:\n\t#Calculate Outer UCL value based on the min sample size\n\touterSigma3 = 3 * math.sqrt(pBar * (100.0 - pBar) / minSampleSize)\n\touterUCL = pBar + outerSigma3\n\t\n\t#Calculate Inner UCL value based on the max sample size\n\tinnerSigma3 = 3 * math.sqrt(pBar * (100.0 - pBar) / maxSampleSize)\n\tinnerUCL = pBar + innerSigma3\n\n\t#Get the columnn indexes within the SPC data \n\tpColNdx = ds.getColumnIndex(\"p\")\n\tpUCLColNdx = ds.getColumnIndex(\"p UCL\")\n\t\n\t#Cycle through all points again\n\tfor row in range(ds.rowCount):\n\t\tp = ds.getValueAt(row, pColNdx)\n\t\tif p > innerUCL and p < outerUCL:\n\t\t\t#Because the point is between the inner and outer limits, calculate the exact limits for this point\n\t\t\tinspCnt = ds.getValueAt(row, inspectedColNdx)\n\t\t\tpUCL = p + 3 * math.sqrt(p * (1 - p) / inspCnt)\n\t\t\t#Save it back to the SPC data for this point\n\t\t\tevent.setValue(row, pUCLColNdx, pUCL)\n\t\telse:\n\t\t\t#Otherwise, just use the outer limit\n\t\t\tevent.setValue(row, pUCLColNdx, outerUCL)\n\t\t\t\n\t#Return the new p LCL back to the SPC module\n\tevent.setControlLimitValue(outerUCL)\n",""
"u LCL","26","java.awt.Color[r=255,g=200,b=0]","#u LCL Calculation\nimport math\n\n#Get the SPC data that the u LCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \ninspectedColNdx = ds.getColumnIndex(\"InspectedCount\")\nnonconformitiesColNdx = ds.getColumnIndex(\"Total Nonconformities\")\n\n#Initialize inspected and nonconforming sums that are need to calculate u. \ninspectedSum = 0.0\nnonconformitiesSum = 0.0\n\n#Track the max and min of inspected items during the samplings \nminSampleSize = 9999999\nmaxSampleSize = 0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tinspCnt = ds.getValueAt(row, inspectedColNdx)\n\tinspectedSum = inspectedSum + inspCnt\n\tnonconformitiesSum = nonconformitiesSum + ds.getValueAt(row, nonconformitiesColNdx)\n\tif inspCnt < minSampleSize:\n\t\tminSampleSize = inspCnt\n\tif inspCnt > maxSampleSize:\n\t\tmaxSampleSize = inspCnt\t\n\t\n#Calculate the average u\nuBar = nonconformitiesSum / inspectedSum * 100.0\n\n#Determine the variation in sample size.\nvariation = (maxSampleSize - minSampleSize) / maxSampleSize;\n\n#If the sample size variation is less than 20%, then use the average sample size else use the min sample size\nif variation < 0.20:\n\tavgSampleSize = inspectedSum / ds.rowCount\n\t#Calculate 3 sigma value\n\tsigma3 = 3 * math.sqrt(uBar / avgSampleSize)\n\t#Calculate the u LCL\n\tlcl = uBar - sigma3\n\t#Return the new u LCL back to the SPC module\n\tevent.setControlLimitValue(lcl)\nelse:\n\t#Calculate Outer LCL value based on the min sample size\n\touterSigma3 = 3 * math.sqrt(uBar / minSampleSize)\n\touterLCL = uBar - outerSigma3\n\t\n\t#Calculate Inner LCL value based on the max sample size\n\tinnerSigma3 = 3 * math.sqrt(uBar / maxSampleSize)\n\tinnerLCL = uBar - innerSigma3\n\n\t#Get the columnn indexes within the SPC data \n\tuColNdx = ds.getColumnIndex(\"uBar\")\n\tuLCLColNdx = ds.getColumnIndex(\"u LCL\")\n\t\n\t#Cycle through all points again\n\tfor row in range(ds.rowCount):\n\t\tu = ds.getValueAt(row, uColNdx)\n\t\tif u > innerLCL and u < outerLCL:\n\t\t\t#Because the point is between the inner and outer limits, calculate the exact limits for this point\n\t\t\tinspCnt = ds.getValueAt(row, inspectedColNdx)\n\t\t\tuLCL = u - 3 * math.sqrt(u / inspCnt)\n\t\t\t#Save it back to the SPC data for this point\n\t\t\tevent.setValue(row, uLCLColNdx, uLCL)\n\t\telse:\n\t\t\t#Otherwise, just use the outer limit\n\t\t\tevent.setValue(row, uLCLColNdx, outerLCL)\n\t\t\t\n\t#Return the new u LCL back to the SPC module\n\tevent.setControlLimitValue(outerLCL)\n",""
"u UCL","25","java.awt.Color[r=255,g=200,b=0]","#u UCL Calculation\nimport math\n\n#Get the SPC data that the u UCL will be calculated for\nds = event.getData()\n\n#Get the columnn indexes within the SPC data \ninspectedColNdx = ds.getColumnIndex(\"InspectedCount\")\nnonconformitiesColNdx = ds.getColumnIndex(\"Total Nonconformities\")\n\n#Initialize inspected and nonconforming sums that are need to calculate u. \ninspectedSum = 0.0\nnonconformitiesSum = 0.0\n\n#Track the max and min of inspected items during the samplings \nminSampleSize = 9999999\nmaxSampleSize = 0\n\n#Cycle through each row and add to the sums\nfor row in range(ds.rowCount):\n\tinspCnt = ds.getValueAt(row, inspectedColNdx)\n\tinspectedSum = inspectedSum + inspCnt\n\tnonconformitiesSum = nonconformitiesSum + ds.getValueAt(row, nonconformitiesColNdx)\n\tif inspCnt < minSampleSize:\n\t\tminSampleSize = inspCnt\n\tif inspCnt > maxSampleSize:\n\t\tmaxSampleSize = inspCnt\t\n\t\n#Calculate the average u\nuBar = nonconformitiesSum / inspectedSum * 100.0\n\n#Determine the variation in sample size.\nvariation = (maxSampleSize - minSampleSize) / maxSampleSize;\n\n#If the sample size variation is less than 20%, then use the average sample size else use the min sample size\nif variation < 0.20:\n\tavgSampleSize = inspectedSum / ds.rowCount\n\t#Calculate 3 sigma value\n\tsigma3 = 3 * math.sqrt(uBar / avgSampleSize)\n\t#Calculate the u UCL\n\tucl = uBar + sigma3\n\t#Return the new u UCL back to the SPC module\n\tevent.setControlLimitValue(ucl)\nelse:\n\t#Calculate Outer UCL value based on the min sample size\n\touterSigma3 = 3 * math.sqrt(uBar / minSampleSize)\n\touterUCL = uBar + outerSigma3\n\t\n\t#Calculate Inner UCL value based on the max sample size\n\tinnerSigma3 = 3 * math.sqrt(uBar / maxSampleSize)\n\tinnerUCL = uBar + innerSigma3\n\n\t#Get the columnn indexes within the SPC data \n\tuColNdx = ds.getColumnIndex(\"uBar\")\n\tuUCLColNdx = ds.getColumnIndex(\"u UCL\")\n\t\n\t#Cycle through all points again\n\tfor row in range(ds.rowCount):\n\t\tu = ds.getValueAt(row, uColNdx)\n\t\tif u > innerUCL and u < outerUCL:\n\t\t\t#Because the point is between the inner and outer limits, calculate the exact limits for this point\n\t\t\tinspCnt = ds.getValueAt(row, inspectedColNdx)\n\t\t\tuUCL = u + 3 * math.sqrt(u / inspCnt)\n\t\t\t#Save it back to the SPC data for this point\n\t\t\tevent.setValue(row, uUCLColNdx, uUCL)\n\t\telse:\n\t\t\t#Otherwise, just use the outer limit\n\t\t\tevent.setValue(row, uUCLColNdx, outerUCL)\n\t\t\t\n\t#Return the new u UCL back to the SPC module\n\tevent.setControlLimitValue(outerUCL)\n",""