#!/usr/bin/env python

import csv
import binascii

def somedecode(filename):
  with open(filename, 'rb') as csvfile:
    spamreader = csv.reader(csvfile, delimiter=',', quotechar='"')
    header = last = None
    ln = 0
    v = ""
    
    for row in spamreader:
      if header is None:
        header = row
        continue
      if last is None:
        last = row
        continue
      
      va = str(int((float(row[1])-float(last[1])-0.05)*10))
      if va not in ["0","1"]:
        va = "1"

      v = v+va
      ln += 1
      if ln == 8:
        print binascii.unhexlify('%x' % int(v, 2)),
        v = ""
        ln = 0
      last = row

if __name__ == "__main__":
	somedecode("filtered.dehexed.csv")

