Mercurial Hosting > traffic-intelligence
comparison trafficintelligence/utils.py @ 1059:a87b3072bd26
working version
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 11 Jul 2018 01:48:42 -0400 |
parents | 16575ca4537d |
children | c04550f957ab |
comparison
equal
deleted
inserted
replaced
1058:16575ca4537d | 1059:a87b3072bd26 |
---|---|
339 seconds = seconds - m*60 | 339 seconds = seconds - m*60 |
340 return time(h, m, seconds) | 340 return time(h, m, seconds) |
341 | 341 |
342 def timeToFrames(t, frameRate): | 342 def timeToFrames(t, frameRate): |
343 return frameRate*(t.hour*3600+t.minute*60+t.second) | 343 return frameRate*(t.hour*3600+t.minute*60+t.second) |
344 | |
345 def timeModulo(t, duration): | |
346 'returns the time modulo the duration in min' | |
347 return time(t.hour, t.minute//duration, t.second) | |
344 | 348 |
345 def sortXY(X,Y): | 349 def sortXY(X,Y): |
346 'returns the sorted (x, Y(x)) sorted on X' | 350 'returns the sorted (x, Y(x)) sorted on X' |
347 D = {} | 351 D = {} |
348 for x, y in zip(X,Y): | 352 for x, y in zip(X,Y): |