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_entry = trace_data[trace_id][delta_t]
- trace_entry[0] += distance
- trace_entry[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] / v[1]
- MSD_traces[trace_id].append((mean, delta_t))
- return MSD_traces
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement