Created
September 27, 2016 18:42
-
-
Save craigderington/9a95c3f809d5cd9ffebd36d0eafd30c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import collections | |
import random | |
import time | |
DataPoint = collections.namedtuple('DataPoint', 'id, x, y, temp, quality') | |
def main(): | |
print('Creating dataset.') | |
data_list = [] | |
random.seed(0) | |
for id in range(500): | |
x = random.randint(0, 249) | |
y = random.randint(250, 499) | |
temp = random.randint(-20, 40) | |
quality = random.random() | |
data_list.append(DataPoint(id, x, y, temp, quality)) | |
print('Data generation complete, sorting on id...') | |
data_list.sort(key=lambda d: d.id) | |
print('Sorting finished.') | |
time.sleep(3) | |
sys.stdout.flush() | |
print(data_list) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment