diff --git a/python/bin/villas-cumulative-dist b/python/bin/villas-cumulative-dist deleted file mode 100755 index acdf6a39f..000000000 --- a/python/bin/villas-cumulative-dist +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python - -import csv -import sys -import numpy as np -import matplotlib.pyplot as plt -import re - -# check if called correctly -if len(sys.argv) < 2: - sys.exit('Usage: %s FILE1 FILE2' % sys.argv[0]) - -plt.figure(figsize=(8,4)) - -for fn in sys.argv[1:]: - -# m = re.match('[a-zA-Z-]+[-_](\d+)[-_](\d+).', fn) -# rate = m.group(1) -# values = m.group(2) -# print 'Processing file %s (rate=%s, values=%s)' % (fn, rate, values) - - # read data from file - data = [ ] - with open(fn) as f: - reader = csv.reader(f, delimiter='\t') - - for row in reader: - offset = float(row[0]) - -# if fn != 'nrel-test1_offset.log': -# offset = offset * 0.001 - - if offset > 100: - continue - - data.append(offset) - - # evaluate the histogram - values, base = np.histogram(data, bins='fd') - - # evaluate the cumulative - cumulative = np.cumsum(values) - cumscaled = [ float(x) / len(data) for x in cumulative ] - - # plot the cumulative function - plt.plot(base[:-1], cumscaled, label=fn, linewidth=1) - - # plot the distribution - #valscaled = [ float(x) / len(data) for x in values ] - #plt.plot(base[:-1], valscaled, label=fn, linewidth=1) - -plt.xlabel('RTT (s)') -plt.ylabel('Cum. Probability') -plt.grid(color='0.75') - -#plt.yscale('log') - -#plt.ylim([0, 1.03]) -#plt.xlim([0.025, 0.05]) - -lgd = plt.legend(title='Rate (p/s)', loc='center left', bbox_to_anchor=(1, 0.5)) - -plt.show() - -#plt.savefig('cumdist.png', dpi=600, bbox_extra_artists=(lgd,), bbox_inches='tight') diff --git a/python/bin/villas-extract-rtt b/python/bin/villas-extract-rtt deleted file mode 100755 index f4556c9a3..000000000 --- a/python/bin/villas-extract-rtt +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env python - -import csv -import sys -import villas.human as vh - -# check if called correctly -if len(sys.argv) != 1: - sys.exit('Usage: %s < IN_FILE > OUT_FILE' % sys.argv[0]) - -with sys.stdin as f: - reader = csv.reader(f, delimiter='\t') - - for row in reader: - m = vh.Message.parse(row) - - if m.ts == None or m.ts.offset == None: - continue - - print(m.ts.offset) diff --git a/python/bin/villas-file-filter b/python/bin/villas-file-filter deleted file mode 100755 index 900aa64f1..000000000 --- a/python/bin/villas-file-filter +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env python - -import sys -import villas.human as vh - -if len(sys.argv) != 3: - print("Usage: %s from to" % (sys.argv[0])) - sys.exit(-1) - -start = vh.Timestamp.parse(sys.argv[1]) -end = vh.Timestamp.parse(sys.argv[2]) - -for line in sys.stdin: - msg = vh.Message.parse(line) - - if start <= msg.ts <= end: - print msg diff --git a/python/bin/villas-file-merge b/python/bin/villas-file-merge deleted file mode 100755 index da792d899..000000000 --- a/python/bin/villas-file-merge +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python - -import sys -import villas.human - -files = sys.argv[1:] - -all = [ ] -last = { } - -for file in files: - handle = sys.stdin if file == '-' else open(file, "r") - - msgs = [ ] - for line in handle.xreadlines(): - msgs.append(vh.Message.parse(line, file)) - - all += msgs - last[file] = vh.Message(vh.Timestamp(), [0] * len(msgs[0].values), file) - -all.sort() -for msg in all: - last[msg.source] = msg - - values = [ ] - for file in files: - values += last[file].values - - print(vh.Message(msg.ts, values, "")) diff --git a/python/setup.py b/python/setup.py index 65bff02cc..26729a93e 100644 --- a/python/setup.py +++ b/python/setup.py @@ -32,6 +32,5 @@ setup( ], setup_requires=[ 'm2r' - ], - scripts=glob('bin/*') + ] ) diff --git a/python/villas/human/__init__.py b/python/villas/human/__init__.py deleted file mode 100644 index 4403570de..000000000 --- a/python/villas/human/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from message import Message # noqa F401 -from timestamp import Timestamp # noqa F401 diff --git a/python/villas/human/message.py b/python/villas/human/message.py deleted file mode 100644 index 996d502bf..000000000 --- a/python/villas/human/message.py +++ /dev/null @@ -1,30 +0,0 @@ -import villas.human.timestamp as ts -from functools import total_ordering - - -@total_ordering -class Message: - """Parsing a VILLASnode sample from a file (not a UDP package!!)""" - - def __init__(self, ts, values, source=None): - self.source = source - self.ts = ts - self.values = values - - @classmethod - def parse(cls, line, source=None): - csv = line.split() - - t = ts.Timestamp.parse(csv[0]) - v = map(float, csv[1:]) - - return Message(t, v, source) - - def __str__(self): - return '%s %s' % (self.ts, " ".join(map(str, self.values))) - - def __eq__(self, other): - return self.ts == other.ts - - def __lt__(self, other): - return self.ts < other.ts diff --git a/python/villas/human/timestamp.py b/python/villas/human/timestamp.py deleted file mode 100644 index 8afea0f16..000000000 --- a/python/villas/human/timestamp.py +++ /dev/null @@ -1,54 +0,0 @@ -import re -from functools import total_ordering - - -@total_ordering -class Timestamp: - """Parsing the VILLASnode human-readable timestamp format""" - - def __init__(self, seconds=0, nanoseconds=None, - offset=None, sequence=None): - self.seconds = seconds - self.nanoseconds = nanoseconds - self.offset = offset - self.sequence = sequence - - @classmethod - def parse(cls, ts): - m = re.match(r'(\d+)(?:\.(\d+))?([-+]\d+(?:\.\d+)?' - r'(?:e[+-]?\d+)?)?(?:\((\d+)\))?', ts) - - seconds = int(m.group(1)) # Mandatory - nanoseconds = int(m.group(2)) if m.group(2) else None - offset = float(m.group(3)) if m.group(3) else None - sequence = int(m.group(4)) if m.group(4) else None - - return Timestamp(seconds, nanoseconds, offset, sequence) - - def __str__(self): - str = "%u" % (self.seconds) - - if self.nanoseconds is not None: - str += ".%09u" % self.nanoseconds - if self.offset is not None: - str += "+%u" % self.offset - if self.sequence is not None: - str += "(%u)" % self.sequence - - return str - - def __float__(self): - sum = float(self.seconds) - - if self.nanoseconds is not None: - sum += self.nanoseconds * 1e-9 - if self.offset is not None: - sum += self.offset - - return sum - - def __eg__(self, other): - return float(self) == float(other) - - def __lt__(self, other): - return float(self) < float(other)