#================= Main script of KE tool =====================================#
#Read from the given directory the Excel document with the input data
workbook=xlrd.open_workbook('inputData.xls')
worksheets=workbook.sheet_names()
worksheet_ProcessingTimes=worksheets[1]#Define the worksheet with the Processing times data
worksheet_ScrapQuantity=worksheets[0]#Define the worksheet with the Scrap Quantity data
A=Import_Excel()#Call the Python object Import_Excel
ProcessingTimes=A.Input_data(worksheet_ProcessingTimes,workbook)#Create the Processing Times dictionary with keys the different stations in the line and values the processing times of different batches in these stations
ScrapQuantity=A.Input_data(worksheet_ScrapQuantity,workbook)#Create the Scrap Quantity dictionary with keys the different stations in the line and values the scrap quantity data of different batches in these stations
##Get from the Scrap Quantity dictionary the different keys and define the following lists with the scrap quantity data of the different stations in the topology
P7_Scrap=ScrapQuantity.get('P7',[])
P1_Scrap=ScrapQuantity.get('P1',[])
P2_Scrap=ScrapQuantity.get('P3',[])
P3_Scrap=ScrapQuantity.get('P3',[])
P8_Scrap=ScrapQuantity.get('P8',[])
P9_Scrap=ScrapQuantity.get('P9',[])
##Get from the Processing times dictionary the different keys and define the following lists with the processing times data of the different stations in the topology
P7_Proc=ProcessingTimes.get('P7',[])
P1_Proc=ProcessingTimes.get('P1',[])
P2_Proc=ProcessingTimes.get('P2',[])
P3_Proc=ProcessingTimes.get('P3',[])
P8_Proc=ProcessingTimes.get('P8',[])
P9_Proc=ProcessingTimes.get('P9',[])
#Call the HandleMissingValues object and replace with zero the missing values in the lists with the scrap quantity data
B=HandleMissingValues()
P7_Scrap=B.ReplaceWithZero(P7_Scrap)
P1_Scrap=B.ReplaceWithZero(P1_Scrap)
P2_Scrap=B.ReplaceWithZero(P2_Scrap)
P3_Scrap=B.ReplaceWithZero(P3_Scrap)
P8_Scrap=B.ReplaceWithZero(P8_Scrap)
P9_Scrap=B.ReplaceWithZero(P9_Scrap)
# #Call the BasicSatatisticalMeasures object
C=BasicStatisticalMeasures()
#Create a list with values the calculated mean value of scrap quantity on the different stations in the line