|
1 | 1 | #!/usr/bin/env python2
|
2 | 2 |
|
3 |
| -import sys |
4 |
| -import discoverparams |
5 |
| -import readfactors |
6 |
| -import random |
7 |
| -import json |
8 |
| -import os |
9 |
| -import codecs |
10 | 3 | import calendar
|
| 4 | +import codecs |
| 5 | +import os |
| 6 | +import random |
11 | 7 | import time
|
12 |
| -from datetime import date,datetime,timedelta |
| 8 | +from datetime import datetime,timedelta |
| 9 | + |
| 10 | +import readfactors |
13 | 11 | from timeparameters import *
|
14 |
| -from calendar import timegm |
15 | 12 |
|
16 | 13 | START_DATE=datetime.strptime("2010-01-01", "%Y-%m-%d")
|
17 | 14 | END_DATE=datetime.strptime("2013-01-01", "%Y-%m-%d")
|
18 | 15 |
|
19 | 16 | def format_date(date):
|
20 | 17 | return int(time.mktime(date.timetuple())*1000)
|
21 | 18 |
|
22 |
| -# class ParamsWriter: |
23 |
| -# def __init__(self, name, num_params): |
24 |
| -# self.files = [] |
25 |
| -# for i in range(0, num_params): |
26 |
| -# self.files.append(codecs.open("params/"+name+"."+str(i+1)+".params", "w",encoding="utf-8")) |
27 |
| - |
28 |
| -# def append(self, params): |
29 |
| -# for i, param in enumerate(params): |
30 |
| -# self.files[i].write(param+"\n") |
31 | 19 |
|
32 | 20 | class ParamsWriter:
|
33 | 21 | def __init__(self, outdir, number, param_names):
|
@@ -103,20 +91,6 @@ def prob_post_lengths():
|
103 | 91 | results = [20,40,113,97,240]
|
104 | 92 | return results
|
105 | 93 |
|
106 |
| - |
107 |
| -# def post_three_month_params(sample, lower_bound, upper_bound): |
108 |
| -# results = [] |
109 |
| -# for ix in range(0, len(sample)/12): |
110 |
| -# start_ix = ix*12 |
111 |
| -# count_sum = 0 |
112 |
| -# for offset, count in sample[start_ix:start_ix+12]: |
113 |
| -# count_sum += count |
114 |
| -# if count_sum > lower_bound and count_sum < upper_bound: |
115 |
| -# start_day = sample[start_ix][0] |
116 |
| -# end_day = sample[start_ix+12][0] |
117 |
| -# results.append([[start_day, end_day], count_sum]) |
118 |
| -# return results |
119 |
| - |
120 | 94 | def key_params(sample, lower_bound, upper_bound):
|
121 | 95 | results = []
|
122 | 96 | for key, count in sample:
|
|
0 commit comments