Commit 561ff9fc authored by panos's avatar panos

The KE tool main script ammended to call the JSONOutput object

parent e874f11c
...@@ -27,6 +27,7 @@ from DistributionFitting import Distributions ...@@ -27,6 +27,7 @@ from DistributionFitting import Distributions
from ImportExceldata import Import_Excel from ImportExceldata import Import_Excel
from ExcelOutput import Output from ExcelOutput import Output
from ReplaceMissingValues import HandleMissingValues from ReplaceMissingValues import HandleMissingValues
from JSONOutput import JSONOutput
import xlrd import xlrd
import json import json
import dream.simulation.LineGenerationJSON as ManPyMain #import ManPy main JSON script import dream.simulation.LineGenerationJSON as ManPyMain #import ManPy main JSON script
...@@ -56,32 +57,19 @@ M2ProcTime_dist = MLE.Normal_distrfit(M2_ProcTime) ...@@ -56,32 +57,19 @@ M2ProcTime_dist = MLE.Normal_distrfit(M2_ProcTime)
#======================= Output preparation: output the updated values in the JSON file of this example ================================# #======================= Output preparation: output the updated values in the JSON file of this example ================================#
jsonFile = open('OLD_JSON_TwoParallel.json','r') #It opens the JSON file jsonFile = open('JSON_TwoParallelStations.json','r') #It opens the JSON file
data = json.load(jsonFile) #It loads the file data = json.load(jsonFile) #It loads the file
jsonFile.close() jsonFile.close()
nodes = data['graph']['node'] #It creates a variable that holds the 'nodes' dictionary
procTimeM1dict={} exportJSON=JSONOutput()
procTimeM2dict={} stationId1='St1'
dist=M1ProcTime_dist['distributionType'] stationId2='St2'
del M1ProcTime_dist['distributionType'] data1=exportJSON.ProcessingTimes(data, stationId1, M1ProcTime_dist)
procTimeM1dict[dist]=M1ProcTime_dist data2=exportJSON.ProcessingTimes(data1, stationId2, M2ProcTime_dist)
dist=M2ProcTime_dist['distributionType'] jsonFile = open('JSON_ParallelStations_Output.json',"w") #It opens the JSON file
del M2ProcTime_dist['distributionType'] jsonFile.write(json.dumps(data2, indent=True)) #It writes the updated data to the JSON file
procTimeM2dict[dist]=M2ProcTime_dist jsonFile.close() #It closes the file
for element in nodes:
processingTime = nodes[element].get('processingTime',{}) #It creates a variable that gets the element attribute 'processingTime'
if element == 'St1':
nodes['St1']['processingTime'] = procTimeM1dict #It checks using if syntax if the element is 'M1'
elif element == 'St2':
nodes['St2']['processingTime'] = procTimeM2dict #It checks using if syntax if the element is 'M2'
jsonFile = open('JSON_ParallelStations_Output.json',"w") #It opens the JSON file
jsonFile.write(json.dumps(data, indent=True)) #It writes the updated data to the JSON file
jsonFile.close() #It closes the file
#=================== Calling the ExcelOutput object, outputs the outcomes of the statistical analysis in xls files ==========================# #=================== Calling the ExcelOutput object, outputs the outcomes of the statistical analysis in xls files ==========================#
export=Output() export=Output()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment