Add check for even array length when using arrayToQPath(connect='pairs')

This commit is contained in:
Luke Campagnola 2014-02-28 08:55:30 -05:00
parent 5b6bc6715c
commit ab0729bb04

View File

@ -1157,6 +1157,8 @@ def arrayToQPath(x, y, connect='all'):
# decide which points are connected by lines
if connect == 'pairs':
connect = np.empty((n/2,2), dtype=np.int32)
if connect.size != n:
raise Exception("x,y array lengths must be multiple of 2 to use connect='pairs'")
connect[:,0] = 1
connect[:,1] = 0
connect = connect.flatten()