An iterator of timeseries as tuples.
183584
def tsiterator(ts, dateconverter=None, desc=None,
               clean=False, start_value=None, **kwargs):
    ''''''
    dateconverter = dateconverter or default_converter
    yield ['Date'] + ts.names()
    if clean == 'full':
        for dt, value in full_clean(ts, dateconverter, desc, start_value):
             yield (dt,) + tuple(value)
    else:
        if clean:
            ts = ts.clean()
        for dt, value in ts.items(desc=desc, start_value=start_value):
            dt = dateconverter(dt)
            yield (dt,) + tuple(value)
82865
def chunks(items, n):
    
    it = iter(items)
    chunk = tuple(itertools.islice(it, n))
    while chunk:
        yield chunk
        chunk = tuple(itertools.islice(it, n))
874553
async function* generateTimeseries(
    lineDescriptors, revisions, levelOfDetail) {
  const readers = [];
  const timeseriesesByLine = [];

  for (const lineDescriptor of lineDescriptors) {
    const fetchDescriptors = ChartTimeseries.createFetchDescriptors(
        lineDescriptor, levelOfDetail);
    const timeserieses = new Array(fetchDescriptors.length);
    timeseriesesByLine.push({lineDescriptor, timeserieses});

    for (let fetchIndex = 0; fetchIndex < fetchDescriptors.length;
      ++fetchIndex) {
      readers.push((async function* () {
        const request = new TimeseriesRequest({
          ...fetchDescriptors[fetchIndex],
          ...revisions,
        });

        for await (const timeseries of request.reader()) {
          // Replace any previous timeseries from this reader.
          // TimeseriesCacheRequest merges results progressively.
          timeserieses[fetchIndex] = timeseries;
          yield {/* Pump BatchIterator. See timeseriesesByLine. */};
        }
      })());
    }
  }

  // Use BatchIterator only to batch result *events*, not the results
  // themselves. Manually collate results above to keep track of which line
  // and request go with each timeseries.

  for await (const {results, errors} of new BatchIterator(readers)) {
    const filtered = filterTimeseriesesByLine(timeseriesesByLine);
    yield {timeseriesesByLine: filtered, errors};
  }
}
328312
def _iter_withprogress(iterable, progress, log):
    """"""
    before_all = time.time()
    before = before_all
    n = 0
    for i, o in enumerate(iterable):
        yield o
        n = i+1
        if n % progress == 0:
            after = time.time()
            log('%s rows in %.2fs; batch in %.2fs (%d rows/s)'
                % (n, after-before_all, after-before, progress/(after-before)))
            before = after
    after_all = time.time()
    log('%s rows in %.2fs (%d rows/s)'
        % (n, after_all-before_all, n/(after_all-before_all)))
1156514
def slice(self, start, end):
        
        start, end, mask = \
            self._check_boundaries(start, end, allow_infinite=True)

        result = TimeSeries(default=self.default)
        for t0, t1, value in self.iterperiods(start, end):
            result[t0] = value

        result[t1] = self[t1]

        return result
969999
def map(self, fn):
        """"""
        return TimeSeries([(x, fn(y)) for x, y in self.points])
373630
def seriesshape(self):
        """"""
        seriesshape = [len(hydpy.pub.timegrids.init)]
        seriesshape.extend(self.shape)
        return tuple(seriesshape)
872446
def query_timeseries(self, query, from_time=None, to_time=None, by_post=False):
    
    return timeseries.query_timeseries(self, query, from_time, to_time, by_post=by_post)
1000180
def cells(self) -> Generator[Tuple[int, int], None, None]:
        """"""
        yield from itertools.product(
            range(self.row_start, self.row_end),
            range(self.column_start, self.column_end)
        )
1020735
def iteritems(cls):
        
        for key in dir(cls):
            val = getattr(cls, key)
            if isinstance(cls, val):
                yield (key, val)
1066506
def iterator(self):
        """"""
        if self.combined:
            grouped_data = [[(0, datum)] for datum in self.data]
            skip_dims = {"chain"}
        else:
            grouped_data = [datum.groupby("chain") for datum in self.data]
            skip_dims = set()

        label_dict = OrderedDict()
        for name, grouped_datum in zip(self.model_names, grouped_data):
            for _, sub_data in grouped_datum:
                datum_iter = xarray_var_iter(
                    sub_data,
                    var_names=[self.var_name],
                    skip_dims=skip_dims,
                    reverse_selections=True,
                )
                for _, selection, values in datum_iter:
                    label = make_label(self.var_name, selection, position="beside")
                    if label not in label_dict:
                        label_dict[label] = OrderedDict()
                    if name not in label_dict[label]:
                        label_dict[label][name] = []
                    label_dict[label][name].append(values)

        y = self.y_start
        for label, model_data in label_dict.items():
            for model_name, value_list in model_data.items():
                if model_name:
                    row_label = "{}: {}".format(model_name, label)
                else:
                    row_label = label
                for values in value_list:
                    yield y, row_label, label, values, self.model_color[model_name]
                    y += self.chain_offset
                y += self.var_offset
            y += self.group_offset
484865
def absolute(self):
        
        return Timeseries(np.absolute(self), self.tspan, self.labels)
4897
def samples(self):
        """"""
        names = self.series.dimensions
        for n, offset in enumerate(self.series.offsets):
            dt = datetime.timedelta(microseconds=offset * 1000)
            d = {"ts": self.ts + dt}
            for name in names:
                d[name] = getattr(self.series, name)[n]
            yield d
402495
def get_timeseries(self, *args, **kwargs):
        
        import predix.data.timeseries
        ts = predix.data.timeseries.TimeSeries(*args, **kwargs)
        return ts
671744
def T(u, dfs_data):
    """"""
    return list(set([w for v in S_star(u, dfs_data) for w in A(v, dfs_data)]))
361150
def timeseries(self, dataframe=False):
        

        self.query.get_cardinality("author_uuid").by_period()
        return super().timeseries(dataframe)
605274
def _construct_timeseries(self, timeseries, constraints={}):
        
        self.response_from(timeseries, constraints)
        if self.response == None:
            return None
        return {'data':self.response['data'],
                'period':self.response['period'],
                'start time':datetime.datetime.fromtimestamp(self.response['start_time']),
                'end time':datetime.datetime.fromtimestamp(self.response['end_time'])}