def group(self, groups, config): new_results = [] for k in groups.keys(): title = "%s (n=%d)" % (k, len(groups[k])) if self.print_n else k res = ResultSet(TITLE=title, NAME=self.orig_name) x_values = [] for r in groups[k]: if len(r.x_values) > len(x_values): x_values = r.x_values cutoff = config.get('cutoff', None) if cutoff is not None: res.x_values = [ x for x in x_values if x >= cutoff[0] and x <= max(x_values) - cutoff[1] ] else: res.x_values = x_values for s in config['series']: data = zip_longest(x_values, *[r[s['data']] for r in groups[k]]) new_data = [] reducer = self.get_reducer(s) reducer.cutoff = None for d in data: if cutoff is None or (d[0] >= cutoff[0] and d[0] <= max(x_values) - cutoff[1]): new_data.append(reducer(res, s['data'], data=d[1:])) res.add_result(s['data'], new_data) new_results.append(res) return new_results
def group(self, groups, config): new_results = [] for k in groups.keys(): title = "%s (n=%d)" % (k, len(groups[k])) if self.print_n else k res = ResultSet(TITLE=title, NAME=self.orig_name) x_values = [] for r in groups[k]: if len(r.x_values) > len(x_values): x_values = r.x_values cutoff = config.get('cutoff', None) if cutoff is not None: res.x_values = [x for x in x_values if x >= cutoff[0] and x <= max(x_values) - cutoff[1]] else: res.x_values = x_values for s in config['series']: length = max([r.meta("TOTAL_LENGTH") for r in groups[k]]) data = zip_longest(x_values, *[r[s['data']] for r in groups[k]]) new_data = [] reducer = self.get_reducer(s) reducer.cutoff = None for d in data: if cutoff is None or (d[0] >= cutoff[0] and d[0] <= length - cutoff[1]): new_data.append(reducer(res, s, data=d[1:])) res.add_result(s['data'], new_data) new_results.append(res) return new_results
def group(self, groups, config): new_results = [] for k in groups.keys(): title = "%s (n=%d)" % (k, len(groups[k])) if self.print_n else k res = ResultSet(TITLE=title, NAME=self.orig_name) x_values = [] for r in groups[k]: if len(r.x_values) > len(x_values): x_values = r.x_values length = max([r.meta("TOTAL_LENGTH") for r in groups[k]]) cutoff = self.data_cutoff or config.get('cutoff', None) if cutoff is not None: start, end = cutoff if end <= 0: end += length res.x_values = [x for x in x_values if x >= start and x <= end] else: res.x_values = x_values for s in config['series']: data = zip_longest(x_values, *[r[s['data']] for r in groups[k]]) new_data = [] reducer = self.get_reducer(s) reducer.cutoff = None for d in data: if cutoff is None or (d[0] >= start and d[0] <= end): new_data.append(reducer(res, s, data=d[1:])) res.add_result(s['data'], new_data) new_results.append(res) return new_results