-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
53 subphase support #54
Changes from 5 commits
0de9451
8988915
ad98048
041f9a1
acd5d1f
c293fb6
1293869
4ea51bb
84b6a31
3047715
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -138,16 +138,22 @@ def read(self, node_id, time_step=-1, comm=False): | |||
# Iterate over rows of input file | ||||
for row in log: | ||||
n_entries = len(row) | ||||
|
||||
# Handle three-entry case that corresponds to an object load | ||||
if n_entries == 3: | ||||
if '[' in row[4]: | ||||
# Parsing the three-entry case, thus this format: | ||||
# <time_step/phase>, <object-id>, <time> | ||||
# <time_step/phase>, <object-id>, <time>, <#-subphases> '[' | ||||
# [<subphase-time-1>] ... [<subphase-time-N>] ']' | ||||
# Converting these into integers and floats before using them or | ||||
# inserting the values in the dictionary | ||||
try: | ||||
phase, o_id = map(int, row[:2]) | ||||
time = float(row[2]) | ||||
Nsubphases = int(row[3]) | ||||
subphase_times = row[4:] | ||||
assert len(subphase_times) == Nsubphases | ||||
subphase_times[0] = subphase_times[0][1:] | ||||
subphase_times[1] = subphase_times[-1][:-1] | ||||
subphase_times = map(float, subphase_times) | ||||
except: | ||||
print(bcolors.ERR | ||||
+ "* ERROR: [LoadReaderVT] Incorrect row format:".format(row) | ||||
|
@@ -169,13 +175,22 @@ def read(self, node_id, time_step=-1, comm=False): | |||
print(bcolors.HEADER | ||||
+ "[LoadReaderVT] " | ||||
+ bcolors.END | ||||
+ "iteration = {}, object id = {}, time = {}".format( | ||||
+ "iteration = {}, object id = {}, time = {}, subphases = {}".format( | ||||
phase, | ||||
o_id, | ||||
time)) | ||||
time, | ||||
Nsubphases, | ||||
end='')) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not the fault of this PR, but this entire print is questionable - we failed at parsing and hence assigning these variables, so try printing the variables that we didn't parse? The print should be of the (ideally unmodified) |
||||
|
||||
for i in range(0,Nsubphases): | ||||
print("subphase-time-" + str(i) + "= {}".format( | ||||
row[4 + i], | ||||
end='')) | ||||
|
||||
print() | ||||
|
||||
# Handle four-entry case that corresponds to a communication weight | ||||
elif n_entries == 5: | ||||
elif '[' not in row[4]: | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My latest commit addresses this issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||
continue | ||||
# Parsing the five-entry case, thus this format: | ||||
# <time_step/phase>, <to-object-id>, <from-object-id>, <weight>, <comm-type> | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is no longer accurate