postgkyl.collect

postgkyl.collect(*datasets, sumdata=False, period=None, offset=0.0, chunk=None, tag=None, label=None)

Collect many single-frame datasets into one with a new leading time axis.

Accepts collect(a, b) or collect([a, b]) (flattened via gdatastate.flatten_datasets). The per-dataset time stamp is taken from ctx['time'], then ctx['frame'], then the dataset’s position in the sequence as a fallback; frames are sorted by their (possibly folded) time stamp. Each result copies the grid/ctx of its group’s first frame (via _result), so it stays the caller’s concrete dataset class.

Parameters:
  • *datasets – the datasets to collect (each NumPy-backed, sharing a grid and component layout), or lists/groups thereof.

  • sumdata – when True, sum each frame over all of its spatial axes (keeping components) before stacking, so the output grid is just the time axis. When False the full spatial data of each frame is retained and the time axis becomes a new leading dimension.

  • period – when given, fold the time stamps into one period via (time - offset) % period before sorting, producing a phase/epoch axis instead of an unfolded time axis.

  • offset – phase offset subtracted before the modulo when period is used.

  • chunk – when given (and non-zero), split the input into consecutive groups of this length and collect each group separately, returning a list of datasets (one per chunk; the last chunk may be shorter) instead of a single dataset.

  • tag – optional tag for the returned dataset(s).

  • label – optional label for the returned dataset(s) (defaults to 'collect').

Returns:

A single dataset with the collected frames stacked along a new leading time axis, or, when chunk is given, a list of such datasets.

Raises:

ValueError – if there are no datasets to collect, or one is native modal (gkyl-backed).

CLI: collect