unselect

method of dascore.core.spool.Spool source

unselect(
    self ,
    _attrs: collections.abc.Mapping[collections.abc.Mapping[str, Any], str, collections.abc.Iterable[str], None] = None,
    _coords: collections.abc.Mapping[collections.abc.Mapping[str, Any], str, collections.abc.Iterable[str], None] = None,
    **kwargs ,
)-> ‘Self’

Return the spool without the patches a selection would keep.

The complement of select: each keyword means exactly what it means there, and the patches it would match are the ones removed. This is how a spool says what it does not want — one bad tag, an instrument being serviced — without spelling the rest of the archive as a selection.

The patches’ own coordinates are not accepted. Selecting on one trims each patch to the range rather than choosing between patches, so the complement is every patch cut into the pieces outside it — one patch becoming two. Select the ranges to keep instead, or use Patch.unselect on each patch, which can take samples out of its middle.

The coordinates an attached inventory defines along the fiber are different, and are accepted: removing one of those chooses which channels a patch holds. A patch may then be cut into the pieces the query did not match, so len can grow here as well.

Naming nothing raises, and so does naming only no-op selectors (None, ...). select() with no selection is the whole spool, so its complement is an empty one — but “remove nothing” reads just as naturally, and silently emptying a spool is not something to guess at.

Parameters

Parameter Description
_attrs Attribute selections, in the forms
select accepts.
_coords The patches’ own coordinates only to say they are refused; a
coordinate an attached inventory defines along the fiber is
accepted and chooses channels. See above.
**kwargs The selection whose matches are removed.

Examples

import dascore as dc
spool = dc.get_example_spool("diverse_das")
# everything except the patches tagged 'some_tag'
rest = spool.unselect(tag='some_tag')
assert len(rest) + len(spool.select(tag='some_tag')) == len(spool)