subdivision_pieces

function of dascore.utils.chunk_plan source

subdivision_pieces(
    df: DataFrame ,
    cuts ,
    name: str ,
)-> ‘list[list[tuple]]’

Return the inclusive pieces each row’s cuts divide it into.

The pieces of a row partition its samples: none is dropped and none is duplicated, whatever instant a cut falls on, because each piece ends one step short of where the next begins.

Parameters

Parameter Description
df The relation being subdivided; one row per patch.
cuts One sequence of cut values per row, in the row’s own units, each
above that row’s minimum and no greater than its maximum — a cut
on the maximum yields a one-sample final piece. Order does not
matter. A cut opens a new piece at the first sample at or after
it, so a row with n distinct cuts becomes at most n + 1
pieces.
name The dimension being subdivided.
Note

Every cut row needs a usable step to find its sample grid with, so callers must reject a null or zero step themselves — they are the ones which can name the file it came from.