File size: 623 Bytes
7a71a69 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #!/usr/bin/env python
# encoding: utf-8
import numpy as np
import os
from optparse import OptionParser
if __name__ == '__main__':
# Parse options command line
parser = OptionParser()
parser.add_option("-f", "--filename", dest="filename", metavar="FILE")
# Process options and args
(options, args) = parser.parse_args()
if options.filename is None:
parser.error("required -f [filename] arg.")
data = np.zeros(shape=(30,8))
lines = open(options.filename, 'r').readlines()
for line in lines:
vertex, sensors = line.strip().split(',')
for sensor in sensors.split('_'):
data[vertex, int(sensor) - 1] = 1
|