def main(): print 'nsample = %d' % (nsample) print 'ntracks = %d' % (ntracks) print 'options = %s' % (options) argv = sys.argv argc = len(argv) lef, rig = 0, 1 if argc > 2: lef = int(argv[1]) rig = int(argv[2]) history = history_c() history.load('../../daily/163/data/dbf/2016.dbf') px = [] py = [] foo = [] for i in xrange(lef, rig): rep = run(i, history) foo.append(rep) sys.stdout.flush() px.append(rep[0]) py.append(rep[1]) with open('plabels.json', 'w') as jsf: json.dump(foo, jsf) plt.axhline(y=0, color='k', alpha=0.2) plt.plot(px, py, 'b.') plt.show()
def main(): print 'nsample = %d' % (nsample) print 'ntracks = %d' % (ntracks) sys.stdout.flush() argv = sys.argv argc = len(argv) lef, rig = 0, 1 if argc > 2: lef = int(argv[1]) rig = int(argv[2]) history = history_c() history.load('../data/dbf/2017.dbf') report = [] for pgy in xrange(-30, 30, 6): row = [] for pcy in xrange(-30, 30, 6): acc = 0.0 num = 0.0 for i in xrange(lef, rig): foo = run(i, history, 2.0**pgy, 2.0**pcy) acc += foo[0] num += foo[1] row.append(acc / num) report.append(row) print report
def main(): print 'nsample = %d' % (nsample) print 'ntracks = %d' % (ntracks) print 'options = %s' % (options) argv = sys.argv argc = len(argv) lef, rig = 0, 1 if argc>2: lef = int(argv[1]) rig = int(argv[2]) history = history_c() history.load('../data/dbf/2016.dbf') px = [] py = [[], [], []] pc = ['r.', 'b.', 'g.'] for i in xrange(lef, rig): rep = run(i, history) sys.stdout.flush() px.append(i) for k in xrange(3): py[k].append(rep[k]) plt.axhline(y=0.0, color='k', alpha=0.2) for k in xrange(3): mean = np.array(py[k]).mean() print 'pos %d, mean = %.12f' % (k, mean) plt.plot(px, py[k], pc[k]) plt.axhline(y=mean, color=pc[k][:-1], alpha=0.3) sys.stdout.flush() plt.show()
def main(): history = history_c() history.load('../../daily/163/data/dbf/2012.dbf') jstr = raw_input().strip() task = json.loads(jstr) n = len(task['code']) sample = [(task['code'][i], task['tweek'][i]) for i in xrange(n)] progress(history, sample)
def main(): print 'nsample = %d' % (nsample) print 'ntracks = %d' % (ntracks) argv = sys.argv argc = len(argv) history = history_c() history.load('../data/dbf/2017.dbf') run(history)
def main(): history = history_c() #history.load('../../daily/163/data/dbf/2016.dbf') #history.load('../../daily/163/data/dbf/2012.dbf') history.load('../../daily/163/data/dbf/overview.dbf') foo = history.uniws() for row in foo[::-1]: print row
def main(): notes = 'nsample = %d\n' % (nsample) print 'nsample = %d' % (nsample) notes += 'ntracks = %d\n' % (ntracks) print 'ntracks = %d' % (ntracks) notes += 'options = %s\n' % (options) print 'options = %s' % (options) argv = sys.argv argc = len(argv) lef, rig = 0, 1 pref = '' img = 'untitled.png' if argc > 2: lef = int(argv[1]) rig = int(argv[2]) if argc > 3 and argv[3] != 'ss': pref = argv[3] if argc > 4: img = argv[4] notes += 'cprefix = \'%s\'\n' % (pref) print 'cprefix = \'%s\'' % (pref) history = history_c() #history.load('../../daily/163/data/dbf/2016.dbf') history.load('../../daily/163/data/dbf/2012.dbf') selections = {'code': [], 'tweek': []} px = [] py = [[], [], []] pc = ['r.', 'b.', 'g.'] for i in xrange(lef, rig): rep = run(history, i, pref, selections) sys.stdout.flush() px.append(i) for k in xrange(3): py[k].append(rep[k]) plt.axhline(y=0.0, color='k', alpha=0.2) print json.dumps(selections) for k in xrange(3): mean = np.array(py[k]).mean() notes += 'pos %d, mean = %.24f\n' % (k, mean) print 'pos %d, mean = %.24f' % (k, mean) plt.plot(px, py[k], pc[k]) plt.axhline(y=mean, color=pc[k][:-1], alpha=0.3) sys.stdout.flush() plt.figtext(0.14, 0.11, notes, alpha=0.3, horizontalalignment='left', fontsize=6, multialignment='left', fontweight='normal') #plt.show() plt.savefig(img)
def main(): print 'nsample = %d' % (nsample) print 'ntracks = %d' % (ntracks) argv = sys.argv argc = len(argv) lef, rig = 0, 1 if argc > 2: lef = int(argv[1]) rig = int(argv[2]) history = history_c() history.load('../data/dbf/2017.dbf') for i in xrange(lef, rig): run(i, history) sys.stdout.flush()
def main(): print 'nsample = %d' % (nsample) print 'ntracks = %d' % (ntracks) print 'options = %s' % (options) argv = sys.argv argc = len(argv) lef, rig, logfile = 0, 1, 'benchmark.log' if argc > 2: lef = int(argv[1]) rig = int(argv[2]) #logfile = argv[3] #with open(logfile, 'a') as log: # log.write('nsample = %d\nntracks = %d\noptions = %s\n' % (nsample, ntracks, options)) history = history_c() history.load('../data/dbf/2017.dbf') for i in xrange(lef, rig): run(i, history, logfile) sys.stdout.flush()
def main(): history = history_c() history.load('../../daily/163/data/dbf/2012.dbf') plt.axhline(y=0.0, color='k', alpha=0.2) jstr = raw_input().strip() task = json.loads(jstr) n = len(task['code']) for i in xrange(n): row = history.kweek(task['code'][i], task['tweek'][i]) co = 'r' if row[0] < 1e-6: co = 'g' li = '-' if row[3] < 5: li = '--' plt.plot([i, i], [row[1], row[2]], co + li) plt.plot([i], [row[1]], co + ',') plt.plot([i], [row[2]], co + ',') plt.plot([i], [row[0]], co + 'o') #plt.plot([-1, n], [0, 0], '.', alpha=1.0) plt.xlim(-1, n) plt.show()
def main(): print 'nsample = %d' % (nsample) print 'ntracks = %d' % (ntracks) print 'options = %s' % (options) argv = sys.argv argc = len(argv) lef, rig = 0, 1 if argc > 2: lef = int(argv[1]) rig = int(argv[2]) history = history_c() history.load('../data/dbf/2017.dbf') px = [] py = [] for i in xrange(lef, rig): rep = run(i, history) sys.stdout.flush() px.append(rep[0]) py.append(rep[1]) plt.axhline(y=0, color='k', alpha=0.2) plt.plot(px, py, 'b.') plt.show()
foo.sort(key=lambda tup: (-tup[1])) for i in xrange(3): print '%s y\' = %.6f, y = %.6f' % foo[i] def main(): print 'nsample = %d' % (nsample) print 'ntracks = %d' % (ntracks) sys.stdout.flush() earliest = -1 try: earliest = int(sys.argv[1]) except IndexError, ValueError: print 'error: tweek was not found.' return history = history_c() history.load('../../daily/163/data/dbf/2016.dbf') uniws = history.uniws() for tweek in xrange(earliest + 1): if tweek > 0: print uniws[tweek - 1] else: print '?:??????:????-??-??:(?)' sys.stdout.flush() run(history, tweek, '') sys.stdout.flush() run(history, tweek, 'sh') sys.stdout.flush() if __name__ == '__main__':
def main(): print 'nsample = %d' % (nsample) print 'ntracks = %d' % (ntracks) history = history_c() history.load('../data/dbf/2017.dbf') run(history)