Skip to content

Commit

Permalink
Improved py27 and py3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
siebenkopf committed Sep 18, 2015
1 parent dc772a2 commit 352f5a2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bob/measure/openbr.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,14 @@ def _write_matrix(filename, matrix):
scores[probe].append((score, 0xff if client == id else 0x7f))

# go ahead and sort the scores per probe
scores = {k:sorted(v, key=lambda x: x[0], reverse=True) for k,v in scores.iteritems()}
sorted_scores = {}
for k,v in scores.items(): sorted_scores[k] = sorted(v, key=lambda x: x[0], reverse=True)

# now, write matrix
for p, probe in enumerate(probe_names):
if probe in scores:
for m in range(min(search, len(scores[probe]))):
matrix[p,m], mask[p,m] = scores[probe][m]
for m in range(min(search, len(sorted_scores[probe]))):
matrix[p,m], mask[p,m] = sorted_scores[probe][m]


# OK, now finally write the file in the desired format
Expand Down

0 comments on commit 352f5a2

Please sign in to comment.