reduce_postprocess_ordered¶
- reduce_postprocess_ordered(grouped, postprocess_fn)[source]¶
Reduce grouped index->value dicts by sorting by index and calling a postprocess function.
For each base_key, values are ordered by their integer index and passed to the postprocess function. Use a single callable for all keys (e.g. QEM) or a dict mapping base_key -> callable for per-spec postprocessing (e.g. observable grouping).
Example:
>>> grouped = {(('circ', 0),): {0: 10.0, 1: 20.0}} >>> reduce_postprocess_ordered(grouped, sum) {(('circ', 0),): 30.0}