Mercurial > hg > nsaunier > traffic-intelligence
comparison trafficintelligence/tests/utils.txt @ 1250:77fbd0e2ba7d
dltrack works with moving average filtering
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Thu, 15 Feb 2024 22:04:35 -0500 |
| parents | 4069d8545922 |
| children | bae8de98406f |
comparison
equal
deleted
inserted
replaced
| 1249:2aa56b101041 | 1250:77fbd0e2ba7d |
|---|---|
| 1 >>> from trafficintelligence.utils import * | 1 >>> from trafficintelligence.utils import * |
| 2 >>> from trafficintelligence.moving import Point | 2 >>> from trafficintelligence.moving import Point |
| 3 >>> from numpy import array, arange | |
| 3 | 4 |
| 4 >>> upperCaseFirstLetter('mmmm... donuts') | 5 >>> upperCaseFirstLetter('mmmm... donuts') |
| 5 'Mmmm... Donuts' | 6 'Mmmm... Donuts' |
| 6 >>> s = upperCaseFirstLetter('much ado about nothing') | 7 >>> s = upperCaseFirstLetter('much ado about nothing') |
| 7 >>> s == 'Much Ado About Nothing' | 8 >>> s == 'Much Ado About Nothing' |
| 43 1.3 | 44 1.3 |
| 44 >>> values[2] #doctest: +ELLIPSIS | 45 >>> values[2] #doctest: +ELLIPSIS |
| 45 71.5... | 46 71.5... |
| 46 >>> values[-1] | 47 >>> values[-1] |
| 47 6.0 | 48 6.0 |
| 49 | |
| 50 >>> filterMovingWindow(arange(10), 3) | |
| 51 array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.]) | |
| 52 >>> filterMovingWindow(list(range(10)), 3) | |
| 53 array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.]) | |
| 54 >>> filterMovingWindow(arange(10.), 3) | |
| 55 array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.]) | |
| 56 >>> filterMovingWindow(arange(10.), 2) | |
| 57 array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.]) | |
| 48 | 58 |
| 49 >>> stepPlot([3, 5, 7, 8], 1, 10, 0) | 59 >>> stepPlot([3, 5, 7, 8], 1, 10, 0) |
| 50 ([1, 3, 3, 5, 5, 7, 7, 8, 8, 10], [0, 0, 1, 1, 2, 2, 3, 3, 4, 4]) | 60 ([1, 3, 3, 5, 5, 7, 7, 8, 8, 10], [0, 0, 1, 1, 2, 2, 3, 3, 4, 4]) |
| 51 | 61 |
| 52 >>> mostCommon(['a','b','c','b']) | 62 >>> mostCommon(['a','b','c','b']) |
