Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def process_data(MSD_list, TRACE_COUNT):
- trace_data = [{} for x in range(TRACE_COUNT)]
- for distance, delta_t, trace_id in MSD_list:
- if delta_t in trace_data[trace_id]:
- trace_data[trace_id][delta_t][0] += distance
- trace_data[trace_id][delta_t][1] += 1
- else:
- trace_data[trace_id][delta_t] = [distance, 1]
- MSD_traces = [[] for x in range(TRACE_COUNT)]
- for trace_id in range(TRACE_COUNT):
- for delta_t,v in sorted(trace_data[trace_id].items()):
- mean = v[0] / float(v[1])
- MSD_traces[trace_id].append((mean, delta_t))
- return MSD_traces
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement