# HG changeset patch # User Nicolas Saunier # Date 1342215025 14400 # Node ID 942455aff82991b7e0d28b54d36f56c7e8ef3582 # Parent ee1caff48b039e048b6bb1794b91cf8f54794c5b# Parent d2b68111f87ec72df804b74fea233076368599e5 merged with the addition of Mohamed's code diff -r d2b68111f87e -r 942455aff829 python/utils.py --- a/python/utils.py Fri Jul 13 17:08:31 2012 -0400 +++ b/python/utils.py Fri Jul 13 17:30:25 2012 -0400 @@ -164,6 +164,14 @@ # maths section ######################### +def sortXY(X,Y): + 'returns the sorted (x, Y(x)) sorted on X' + D = {} + for x, y in zip(X,Y): + D[x]=y + xsorted = sorted(D.keys()) + return xsorted, [D[x] for x in xsorted] + def ceilDecimals(v, nDecimals): '''Rounds the number at the nth decimal eg 1.23 at 0 decimal is 2, at 1 decimal is 1.3'''