Permalink
Browse files

Clean-up junk code from tests.py

  • Loading branch information...
Sanket Agarwal
Sanket Agarwal committed Apr 1, 2012
1 parent e86acfc commit 7fd9b4dfc1658ed936440d42bbf024ac884b693d
Showing with 1 addition and 75 deletions.
  1. +1 −75 delay_profile/tests.py
View
@@ -20,62 +20,9 @@
# from Traffic import *
from scipy.stats.stats import pearsonr
-def getDelayForEachFile(data_path):
-
- dataset_files = glob.glob(data_path+'/*23.out')
- delay_set = []
-
- for fn in dataset_files:
-
- d = Delay()
- idx = TrainModel.Indexing(fn)
- idx.constructTrainIndex(10)
- d.runDelayOverAllTrainsAllSegments(idx.idx)
- d.generateAvgDelayStatsForSegments(fn)
- delay_set.append(d)
-
- return delay_set
-
-def getAvgDelayPerSegmentForAllFiles(delay_set):
-
- util= UtilitiesStat()
-
- avg_d_each_day = []
-
- for i in range(len(Segments.all_segments)):
- days = []
- for d in delay_set:
-
- if d.avg_del_list[i][1] != -1000:
- days.append(d.avg_del_list[i][1])
-
- print Segments.all_segments[i]
- print days
- if len(days) > 0:
- avg_d_each_day.append(sum(days)/len(days))
- else:
- avg_d_each_day.append(-1000)
-
- all_seg = []
- all_seg_delays = []
-
- for i in range(len(Segments.all_segments)):
- all_seg.append([Segments.all_segments[i], avg_d_each_day[i]])
- all_seg_delays.append(avg_d_each_day[i])
-
- all_seg = sorted(all_seg, key= lambda x: x[1])
-
- fn = 'FinalDelayStats'
- f = file(fn, 'w')
- for seg in all_seg:
- f.write(str(map(lambda x: util.stn_names[x], seg[0]))+':'+str(seg[1])+'\n')
- f.close()
-
- return all_seg_delays
-
def new_test():
- handle = DailySets(glob.glob('daily_data/*23.out'))
+ handle = DailySets(glob.glob('daily_data/*.out'))
handle.index()
for idx in handle.idx_list:
@@ -87,25 +34,6 @@ def new_test():
handle.hourVsSegmentDelayMat()
handle.hourVsSegmentTrafficMat()
- handle.averageTrafficPS()
- handle.averageTrafficPHS()
-
- handle.averageDelayPS()
- handle.averageDelayPHS()
-
- print 'NEW'
- print handle.total_average_traffic_ps
-
- #getSegmentsSortedByTraffic(handle)
- #getSegmentsSortedByDelay(handle)
-
- ##handle.plotHourlyTraffic()
- ##handle.plotHourlyDelay()
- ##handle.plotHourlyDelayPS()
- ##handle.plotHourlyTrafficPS()
- ##handle.corrHourlyTrafficDelayPS()
- #handle.plotTrafficVsDelayHourly()
-
def getSegmentsSortedByTraffic(handle):
seg_traf_list = map(lambda x: [Segments.all_segments[x], \
@@ -142,7 +70,5 @@ def getTimeTableAugmented():
if __name__=='__main__':
- #d_s = getDelayForEachFile('daily_data/')
- #getAvgDelayPerSegmentForAllFiles(d_s)
new_test()
#getTimeTableAugmented()

0 comments on commit 7fd9b4d

Please sign in to comment.