diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-10-29 21:48:23 -0400 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-10-29 21:48:23 -0400 |
commit | 2e804f8fa7d26755088e47357f8de6feb6dbe292 (patch) | |
tree | 5e96c664fcd2b072d80ad06808371dd0ceb61505 /parse/point.py | |
parent | 5b50c58ea4881dd185897dfa93860c60f551d815 (diff) |
Added option to output parsed data as a python-parseable map.
Diffstat (limited to 'parse/point.py')
-rw-r--r-- | parse/point.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/parse/point.py b/parse/point.py index 8fdd115..d5f4a5e 100644 --- a/parse/point.py +++ b/parse/point.py | |||
@@ -37,12 +37,13 @@ class Measurement(object): | |||
37 | self[Type.Max] = array.max() | 37 | self[Type.Max] = array.max() |
38 | self[Type.Avg] = array.mean() | 38 | self[Type.Avg] = array.mean() |
39 | self[Type.Var] = array.var() | 39 | self[Type.Var] = array.var() |
40 | self[Type.Min] = array.min() | ||
40 | return self | 41 | return self |
41 | 42 | ||
42 | def __check_type(self, type): | 43 | def __check_type(self, type): |
43 | if not type in Type: | 44 | if not type in Type: |
44 | raise AttributeError("Not a valid type '%s'" % type) | 45 | raise AttributeError("Not a valid type '%s'" % type) |
45 | 46 | ||
46 | def __getitem__(self, type): | 47 | def __getitem__(self, type): |
47 | self.__check_type(type) | 48 | self.__check_type(type) |
48 | return self.stats[type] | 49 | return self.stats[type] |
@@ -60,11 +61,11 @@ class Measurement(object): | |||
60 | 61 | ||
61 | def __str__(self): | 62 | def __str__(self): |
62 | return "%s" % dict_str(self.stats, " ") | 63 | return "%s" % dict_str(self.stats, " ") |
63 | 64 | ||
64 | 65 | ||
65 | class Summary(Measurement): | 66 | class Summary(Measurement): |
66 | def __init__(self, id, measures, typemap = default_typemap): | 67 | def __init__(self, id, measures, typemap = default_typemap): |
67 | super(Summary, self).__init__("Summary-%s" % id) | 68 | super(Summary, self).__init__(id) |
68 | 69 | ||
69 | self.__check_types(measures, typemap) | 70 | self.__check_types(measures, typemap) |
70 | self.__summarize(measures, typemap) | 71 | self.__summarize(measures, typemap) |
@@ -108,7 +109,7 @@ class ExpPoint(object): | |||
108 | def __check_val(self, obj): | 109 | def __check_val(self, obj): |
109 | if not isinstance(obj, Measurement): | 110 | if not isinstance(obj, Measurement): |
110 | raise AttributeError("Not a valid measurement '%s'" % obj) | 111 | raise AttributeError("Not a valid measurement '%s'" % obj) |
111 | 112 | ||
112 | def __getitem__(self, type): | 113 | def __getitem__(self, type): |
113 | return self.stats[type] | 114 | return self.stats[type] |
114 | 115 | ||