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
2ca4abda
Commit
2ca4abda
authored
Jun 04, 2013
by
Jérome Perrin
Committed by
Sebastien Robin
Jun 26, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make topology file path an argument to the program
parent
5f4af8e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
DREAM/dream/simulation/LineGenerationJSON.py
DREAM/dream/simulation/LineGenerationJSON.py
+13
-10
No files found.
DREAM/dream/simulation/LineGenerationJSON.py
View file @
2ca4abda
...
...
@@ -27,6 +27,7 @@ import numpy as np
import
json
from
random
import
Random
import
sys
import
os.path
#reads general simulation inputs
def
readGeneralInput
():
...
...
@@ -256,19 +257,20 @@ def activateObjects():
except
AttributeError
:
pass
#the main script that is ran
def
main
():
#the main script that is ran
def
main
(
argv
=
[]):
argv
=
argv
or
sys
.
argv
[
1
:]
#create an empty list to store all the objects in
G
.
ObjList
=
[]
#
user inputs the id of the JSON file
topologyId
=
raw_input
(
"give the topology id
\
n
"
)
#
user passes the topology filename as first argument to the program
filename
=
argv
[
0
]
try
:
G
.
JSONFile
=
open
(
'JSONInputs/Topology'
+
str
(
topologyId
)
+
'.JSON'
,
"r"
)
G
.
JSONFile
=
open
(
filename
,
"r"
)
except
IOError
:
print
"
no such topology file. The programm is terminated"
sys
.
exit
()
print
"
%s could not be open"
%
filename
return
"ERROR"
start
=
time
.
time
()
#start counting execution time
...
...
@@ -314,4 +316,5 @@ def main():
G
.
outputFile
.
save
(
"output.xls"
)
print
"execution time="
+
str
(
time
.
time
()
-
start
)
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
if
__name__
==
'__main__'
:
main
()
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