diff options
Diffstat (limited to 'visualizer/extractor')
-rwxr-xr-x | visualizer/extractor/destinations.py | 19 | ||||
-rwxr-xr-x | visualizer/extractor/stands.py | 14 | ||||
-rwxr-xr-x | visualizer/extractor/test_positions.py | 12 | ||||
-rwxr-xr-x | visualizer/extractor/train_poi.py | 21 |
4 files changed, 66 insertions, 0 deletions
diff --git a/visualizer/extractor/destinations.py b/visualizer/extractor/destinations.py new file mode 100755 index 0000000..967e766 --- /dev/null +++ b/visualizer/extractor/destinations.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +from data.hdf5 import taxi_it +from visualizer import Vlist, Point + + +_sample_size = 5000 + +if __name__ == '__main__': + points = Vlist(cluster=True) + for line in taxi_it('train'): + if len(line['latitude'])>0: + points.append(Point(line['latitude'][-1], line['longitude'][-1])) + if len(points) >= _sample_size: + break + points.save('destinations (cluster)') + points.cluster = False + points.heatmap = True + points.save('destinations (heatmap)') diff --git a/visualizer/extractor/stands.py b/visualizer/extractor/stands.py new file mode 100755 index 0000000..9224143 --- /dev/null +++ b/visualizer/extractor/stands.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +from data.hdf5 import taxi_it +from visualizer import Vlist, Point + + +if __name__ == '__main__': + it = taxi_it('stands') + next(it) # Ignore the "no stand" entry + + points = Vlist() + for (i, line) in enumerate(it): + points.append(Point(line['stands_latitude'], line['stands_longitude'], 'Stand (%d): %s' % (i+1, line['stands_name']))) + points.save('stands') diff --git a/visualizer/extractor/test_positions.py b/visualizer/extractor/test_positions.py new file mode 100755 index 0000000..a84d2ba --- /dev/null +++ b/visualizer/extractor/test_positions.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +from data.hdf5 import taxi_it +from visualizer import Vlist, Point + + +if __name__ == '__main__': + points = Vlist(heatmap=True) + for line in taxi_it('test'): + for (lat, lon) in zip(line['latitude'], line['longitude']): + points.append(Point(lat, lon)) + points.save('test positions') diff --git a/visualizer/extractor/train_poi.py b/visualizer/extractor/train_poi.py new file mode 100755 index 0000000..a4ccbca --- /dev/null +++ b/visualizer/extractor/train_poi.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +import os + +import data +from data.hdf5 import TaxiDataset +from visualizer import Path + + +poi = { + 'longest': 1492417 +} + +if __name__ == '__main__': + prefix = os.path.join(data.path, 'visualizer', 'Train POI') + if not os.path.isdir(prefix): + os.mkdir(prefix) + + d = TaxiDataset('train') + for (k, v) in poi.items(): + Path(d.extract(v)).save(os.path.join('Train POI', k)) |