Browse Source

debugging result analysis

master
poikilos 9 years ago
committed by Jacob Gustafson
parent
commit
551d90048f
  1. 14
      chunkymap-regen.py

14
chunkymap-regen.py

@ -71,6 +71,7 @@ def get_dict_deepcopy(old_dict):
def is_dict_subset(new_dict, old_dict, verbose_messages_enable, verbose_dest_description="unknown file"): def is_dict_subset(new_dict, old_dict, verbose_messages_enable, verbose_dest_description="unknown file"):
is_changed = False is_changed = False
try:
if old_dict is not None: if old_dict is not None:
if new_dict is not None: if new_dict is not None:
old_dict_keys = self.old_dict.keys() old_dict_keys = self.old_dict.keys()
@ -89,6 +90,9 @@ def is_dict_subset(new_dict, old_dict, verbose_messages_enable, verbose_dest_des
else: else:
if new_dict is not None: if new_dict is not None:
is_changed = True is_changed = True
except:
print("Could not finish is_dict_subset:")
view_traceback()
return is_changed return is_changed
def ivec2_equals(pos1, pos2): def ivec2_equals(pos1, pos2):
@ -281,6 +285,8 @@ class MTChunk:
#returns whether save is needed (whether metadata was changed) #returns whether save is needed (whether metadata was changed)
def set_from_genresult(self, this_genresult_path): def set_from_genresult(self, this_genresult_path):
#this_genresult_path = mtchunks.get_chunk_genresult_path(chunk_luid) #this_genresult_path = mtchunks.get_chunk_genresult_path(chunk_luid)
participle = "getting copy of dict"
try:
is_changed = False is_changed = False
old_meta = get_dict_deepcopy(self.metadata) old_meta = get_dict_deepcopy(self.metadata)
if os.path.isfile(this_genresult_path): if os.path.isfile(this_genresult_path):
@ -294,9 +300,12 @@ class MTChunk:
#('Pixels PerNode: ', 1) #('Pixels PerNode: ', 1)
#('border: ', 0) #('border: ', 0)
self.metadata["is_marked"] = True self.metadata["is_marked"] = True
participle = "opening '"+this_genresult_path+"'"
ins = open(this_genresult_path, 'r') ins = open(this_genresult_path, 'r')
line = True line = True
counting_number = 1
while line: while line:
participle = "reading line "+str(counting_number)
line = ins.readline() line = ins.readline()
if line: if line:
line_strip = line.strip() line_strip = line.strip()
@ -361,8 +370,13 @@ class MTChunk:
self.metadata["image_top"] = int(line_strip[5:].strip()) self.metadata["image_top"] = int(line_strip[5:].strip())
except: except:
print("#failed to parse line:"+str(line_strip)) print("#failed to parse line:"+str(line_strip))
counting_number += 1
ins.close() ins.close()
participle = "checking for changes"
is_changed = is_dict_subset(self.metadata, old_meta, False) is_changed = is_dict_subset(self.metadata, old_meta, False)
except:
print("Could not finish "+participle+" in set_from_genresult:")
view_traceback()
return is_changed return is_changed
class MTChunks: class MTChunks:

Loading…
Cancel
Save