Skip to content

Commit

Permalink
correct WidthHeight position error
Browse files Browse the repository at this point in the history
  • Loading branch information
snail123815 committed Jun 29, 2022
1 parent 3c946d9 commit bc90be6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions funcs/parseMetadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ def getPositions(positionTsvPath):
posDict[locType] = {}
# remove padding deal here, only allowing 'WidthHeight' and 'TwoPositions'
if locType == 'removePadding':
assert pLocType in ['TwoPositions', 'WidthHeight'], f'Please set padding position under "WidthHeight" and "TwoPositions", now it is under "{pLocType}"'
assert pLocType in ['TwoPositions', 'WidthHeight'], \
'Please set padding position under "WidthHeight" and "TwoPositions",' + \
f' now it is under "{pLocType}"'
position = [int(elem) for elem in elements[1:]]
# already obey rule of "TwoPositions"
if pLocType == 'WidthHeight':
Expand Down Expand Up @@ -129,7 +131,7 @@ def getPositions(positionTsvPath):
r = int(position[2] / 2)
position = [x - r for x in position[:2]] + [x + r for x in position[:2]]
elif locType == 'WidthHeight':
position = position[:2] + [sum(x) for x in zip(position[2:], position[2:4])]
position = position[:2] + [sum(x) for x in zip(position[:2], position[2:4])]
elif locType == 'TwoPositions':
position = position[:4]
posDict[locType][posName] = position
Expand Down

0 comments on commit bc90be6

Please sign in to comment.