Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
561ff9fc
Commit
561ff9fc
authored
Mar 25, 2015
by
panos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The KE tool main script ammended to call the JSONOutput object
parent
e874f11c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
22 deletions
+10
-22
dream/KnowledgeExtraction/KEtool_examples/TwoParallelStations/TwoParallelStations_example.py
...amples/TwoParallelStations/TwoParallelStations_example.py
+10
-22
No files found.
dream/KnowledgeExtraction/KEtool_examples/TwoParallelStations/TwoParallelStations_example.py
View file @
561ff9fc
...
...
@@ -27,6 +27,7 @@ from DistributionFitting import Distributions
from
ImportExceldata
import
Import_Excel
from
ExcelOutput
import
Output
from
ReplaceMissingValues
import
HandleMissingValues
from
JSONOutput
import
JSONOutput
import
xlrd
import
json
import
dream.simulation.LineGenerationJSON
as
ManPyMain
#import ManPy main JSON script
...
...
@@ -56,32 +57,19 @@ M2ProcTime_dist = MLE.Normal_distrfit(M2_ProcTime)
#======================= 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
jsonFile
.
close
()
nodes
=
data
[
'graph'
][
'node'
]
#It creates a variable that holds the 'nodes' dictionary
procTimeM1dict
=
{}
procTimeM2dict
=
{}
dist
=
M1ProcTime_dist
[
'distributionType'
]
d
el
M1ProcTime_dist
[
'distributionType'
]
procTimeM1dict
[
dist
]
=
M1ProcTime_dist
exportJSON
=
JSONOutput
()
stationId1
=
'St1'
stationId2
=
'St2'
d
ata1
=
exportJSON
.
ProcessingTimes
(
data
,
stationId1
,
M1ProcTime_dist
)
data2
=
exportJSON
.
ProcessingTimes
(
data1
,
stationId2
,
M2ProcTime_dist
)
dist
=
M2ProcTime_dist
[
'distributionType'
]
del
M2ProcTime_dist
[
'distributionType'
]
procTimeM2dict
[
dist
]
=
M2ProcTime_dist
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
jsonFile
=
open
(
'JSON_ParallelStations_Output.json'
,
"w"
)
#It opens the JSON file
jsonFile
.
write
(
json
.
dumps
(
data2
,
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 ==========================#
export
=
Output
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment