From da4b7d22647b48ca1c0420540ee7c3eada2281cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=2E=20Brandenburg?= Date: Fri, 26 Mar 2010 14:55:28 -0400 Subject: Add numpy/scipy based statistics and helpers. --- util.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 util.py (limited to 'util.py') diff --git a/util.py b/util.py new file mode 100644 index 0000000..fdedaa4 --- /dev/null +++ b/util.py @@ -0,0 +1,11 @@ +import numpy as np + +def load_csv_file(fname, *args, **kargs): + return np.genfromtxt(open(fname), delimiter=",", comments="#", + *args, **kargs) + +def select(keep, rows): + ok_rows = np.zeros(len(rows), dtype=bool) + for i, row in enumerate(rows): + ok_rows[i] = keep(row) + return rows[ok_rows] -- cgit v1.2.2