# resolve_channel_pieces

<table class=".origin_table">
    <tr>
        <td style="text-align: left; border-style: hidden">*function*  of [dascore.core._spool_inventory](`dascore.core._spool_inventory`)</td>
        <td style="text-align: right; border-style: hidden">[source](https://github.com/DASDAE/dascore/blob/dev/dascore/core/_spool_inventory.py#L1018-L1079)</td>
    </tr>
</table>

:::{.padded_bottom_10pt}

:::{.def_block}


<b>resolve_channel_pieces</b>(<br>
    &nbsp;&nbsp;&nbsp;&nbsp;inventory
,<br>
    &nbsp;&nbsp;&nbsp;&nbsp;contexts
,<br>
    &nbsp;&nbsp;&nbsp;&nbsp;frame
,<br>
    &nbsp;&nbsp;&nbsp;&nbsp;query
,<br>
    &nbsp;&nbsp;&nbsp;&nbsp;complement: bool
 = False,<br>
)-> 'tuple'


:::

:::
Return the channel dimension, each row's kept pieces, and refusals.

The pieces are what a selection along the fiber keeps: one per
contiguous run of matching channels, so a query a path answers in two
places subdivides the row into two. A row with no context keeps
nothing and says nothing about it — an inventory-backed selector
silently does not match a patch the inventory is silent about, just
as a patch lacking an attr is not selected on it.

Every value is projected onto the channels the way `Patch.enrich`
projects it and judged by the predicate the index applies to a stated
attr, so a selector cannot mean one thing here and another in either.

## Parameters

<table class="table">
  <thead>
    <tr>
            <th scope="col"> Parameter</th>
            <th scope="col"> Description</th>
    </tr>
  </thead>
  <tbody>
        <tr>
            <td>inventory</td>
            <td>The inventory to resolve against.</td>
        </tr>
        <tr>
            <td>contexts</td>
            <td>Each row's resolved context, or None where it has none.</td>
        </tr>
        <tr>
            <td>frame</td>
            <td>The relation being selected; one row per patch.</td>
        </tr>
        <tr>
            <td>query</td>
            <td>The channel-level selectors, by inventory name.</td>
        </tr>
        <tr>
            <td>complement</td>
            <td>Keep the channels the query does *not* match. The mask runs along<br>one dimension, so unlike a patch's rectangle its complement is<br>exactly expressible; a row with no context keeps everything,<br>being a row the selection never held.</td>
        </tr>
  </tbody>
</table>

## Returns
A `(name, pieces, reasons)` triple. `reasons` holds a refusal per row
and None elsewhere; when any row is refused `pieces` is None, since
the caller raises rather than selecting, and `name` is whatever the
rows which placed fine agreed on — possibly None.

