forked from yangl1996/synclc-sim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelay_cdf.py
executable file
·42 lines (34 loc) · 937 Bytes
/
delay_cdf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/python
import math
import os
import sys
import signal
from argparse import ArgumentParser
from time import sleep, time
import glob
import re
import json
from dateutil.parser import *
import numpy
parser = ArgumentParser(description="SyncLC data processing")
parser.add_argument('--dir',
type=str,
help="Directory of the result files",
default=".")
# Expt parameters
args = parser.parse_args()
datapoints = []
if __name__ == "__main__":
files=glob.glob(args.dir+"/*-delay.txt")
for filepath in files:
with open(filepath) as f:
for line in f:
stripped = line.strip()
if stripped != "":
datapoints.append(float(stripped)/1000.0)
N = len(datapoints)
x = numpy.sort(datapoints)
y = numpy.array(range(N))/float(N)
print("midpoint", "density")
for i in range(N):
print(x[i], y[i])