Python command: Statistics

Use the Statistics commands in Python to view calculated statistics for a specific SPC or DMS retrieval. This allows you to view any statistic GainSeeker calculates and any custom statistics you have previously created. Access values in Pareto, OEE, or DPU Detail tables and view the raw data associated with a retrieval.

Also see Python command: Retrieval

See Python commands for other commands you can use with GainSeeker.

 

Contents  [Hide]

 

Shared DMS and SPC commands

Syntax

Example

Description/Remarks

New or changed in GainSeeker version

[statspc/statdms].data

statspc.data.trace(1)

statspc.data.eventspc()

statspc.data.note()

statdms.data.ncu()

Gives access to the underlying data for a retrieval.

All columns in an SPC or DMS data table are available. Calling a method under data returns the values for the associated data table column.

Returns a list.

8.8

8.9

[statspc/statdms].getstat(index)  

statspc.getstat(100)

statdms.getstat(45)

Returns an SPC or DMS statistic based on its index.

For SPC: SPC statistics available

For DMS: DMS statistics available

 

[statspc/statdms].getstatstr(index) 

statspc.getstatstr(100)

statdms.getstatstr(45)

Returns the display string of an SPC or DMS statistic based on its index.

For SPC: SPC statistics available

For DMS: DMS statistics available

 

[statspc/statdms].helpers.average(list)

x = [4, 10, 8]

statdms.helpers.average(x)

Returns an average of the values. Returns None if a non-numeric, non-empty value is found.

 

[statspc/statdms].helpers.count(list, value)

x = [4, 10, 8, 4]

statdms.helpers.count(x, 4)

Returns the number of times a value appears in a list. Can be used with a mixture of text and numbers.

 

[statspc/statdms].helpers.countregex(list, regex)

x = ["goodbye", "8000", "good", "hello"]

statdms.helpers.countregex(x, "\d+")

Returns the number of elements in a list match a regular expression. Can be used with a mixture of text and numbers.

Quick reference for regular expressions

 

[statspc/statdms].helpers.sum(list)

x = [4, 10, 8]

statdms.helpers.sum(x)

Returns the sum of a list of numbers. Returns None if a non-numeric, non-empty value is found.

 

[statspc/statdms].helpers.unique(list)

x = [4, 10, 8, 4]

statdms.helpers.unique(x)

Returns the number of unique values are in a list.

None is considered a unique value.

 

SPC commands

Syntax

Example

Description/Remarks

New or changed in GainSeeker version

statspc.data.rtf()

listRTFcodes = statspc.data.rtf()

Returns a list containing one item for each row of data in the retrieval.

Each item in the list is a number that represents all of the real-time failures (if any) that occurred in that row of data.

For a reference of the failures represented by the returned number, see Real-time Failure codes.

 

statspc.data.rtfstr()

listRTFdescript = statspc.data.rtfstr()

Returns a list containing one item for each row of data in the retrieval.

Each item in the list is a list of all of the real-time failure descriptions (if any) that occurred in that row of data. (So this command actually returns a list of lists.)

 

DMS commands

Syntax

Example

Description/Remarks

New or changed in GainSeeker version

statdms.dpu

statdms.dpu.dpm()

statdms.dpu.sigma()

Gives access to the DPU Detail table columns. Calling a method under DPU returns the values for the column that share its name with the method.

 

statdms.oee

statdms.oee.oeeavailability()

statdms.oee.sumdowntime()

Gives access to the OEE Detail table columns. Calling a method under OEE returns the values for the column that share its name with the method.

 

statdms.pareto

statdms.pareto.ncucost()

statdms.pareto.percenttotalcost()

statdms.pareto.defectcost()

Gives access to the Pareto Detail table columns. Calling a method under Pareto returns the values for the column that share its name with the method.

 

 

Example script

This script retrieves and displays the Note values for one SPC standard and one DMS standard:

 

retrspc.partno = "RH HEADLIGHT 01142 - 06B FLUSH"
list_notes = statspc.data.note()

for x in list_notes:
    
if x != None:
        
print x
        

retrdms.partno =
"A-50 INSERT"
retrdms.process =
"M-CUT OFF"
list_dms_notes = statdms.data.note()

for x in list_dms_notes:
    
if x != None:
        
print x