def convert_ts_list(self, ts_list, time_slice=None):
        ret = []

        slice_dict = {}
        # This will be an int of seconds pulled from TIME_SLICES. This is how
        # large the buckets will be when sorting the time series data.
        if time_slice is None:
            time_slice = "minute"
        time_slice = TIME_SLICES[time_slice]

        if not ts_list:
            return []

        for ts_entry in ts_list:
            ts = int(ts_entry[1])
            count = int(ts_entry[0].split(":")[1])
            key = ts/time_slice
            slice_dict[key] = slice_dict.get(key, 0) + count

        keys = slice_dict.keys()
        keys.sort()
        for i in range(keys[0], keys[-1]):
            if i not in slice_dict:
                slice_dict[i] = 0
        keys = slice_dict.keys()
        keys.sort()

        for key in keys:
            ret.append(TSTuple(key*time_slice, slice_dict[key]))
        return ret
Module's Home Page
dataset/ETHPy150Open gmcquillan/firetower/firetower/category.py/TimeSeries.convert_ts_list--crossover with--dataset/ETHPy150Open sahana/eden/controllers/dc.py/index