stepx = 320 / N stepy = 240 / N r = int(min(stepx, stepy)/2) for i in range(len(segs)): row = int(i / N) col = i % N color = (255,255,255) stroke = 1 if i == cur_idx: color = (0,255,0) stroke = -1 elif tape.isUsed(segs[i]): color = (255, 0, 0) x,y = (col*stepx + r, row*stepy + r) cv2.circle(a, (x,y), r, color, stroke) cv2.putText(a, str(i), (x,y), cv2.FONT_HERSHEY_PLAIN, 1, (255,255,255)) cv2.putText(a, cur_cluster, (305,230), cv2.FONT_HERSHEY_PLAIN, 1, (0,255,0)) if __name__=='__main__': import sys import numm tape = Tape(sys.argv[1]) arr = tape.getArray() clusters = tape.getClusters() numm.run(**globals())
import os import numm USAGE = 'python bsides.py SOURCE [COMPOSITION]' if len(sys.argv) < 2: print USAGE sys.exit(1) source = sys.argv[1] comppath = source + '.composition.pkl' if len(sys.argv) > 2: comppath = sys.argv[2] tape = Tape(source, nbins=9) # preload array tape.getArray() composition = Composition([]) if os.path.exists(comppath): composition = Composition.fromfile(comppath) for r in composition.rhythms: for g in r.groups: for s in g: tape.use(s) structure_init() numm.run(**globals())