import dascore as dc
from dascore.examples import get_example_patch
patch = get_example_patch()
# Drop meters 50 to 300, keeping what lies outside them.
outside = patch.unselect(distance=(50, 300))
# Drop the first ten distance samples.
trimmed = patch.unselect(distance=(..., 10), samples=True)Unselect
Unselect(
*args ,
copy: bool = False,
relative: bool = False,
samples: bool = False,
**kwargs ,
)-> None
Return the patch outside a selection.
The complement of Patch.select: it takes the same selectors and removes the samples that selection would have kept. With one coordinate named that is exactly the complement; with several, each is complemented on its own — see the note below.
Parameters
| Parameter | Description |
|---|---|
| copy | Copy the result so it does not retain the original data array. |
| relative |
If True, unselect ranges are relative to the start of coordinate, if positive, or the end of the coordinate, if negative. |
| samples | If True, the query meaning is in samples. |
| **kwargs | Used to specify the coordinate on which data are unselected. |
Examples
Removing a range from the middle of a coordinate leaves a hole in it, so the result is no longer evenly sampled and the coordinate becomes a monotonic array. That is exactly what
Spool.unselectrefuses the patches’ own coordinates for: at spool level the complement of a range is a hole in every patch rather than a choice between patches. The coordinates an attached inventory defines along the fiber it does accept, since removing one of those chooses which channels a patch holds.Each named coordinate is complemented on its own. Selecting on two coordinates keeps the samples in both ranges, and everything outside that is a frame around them rather than a block, which no array can hold — so
unselectremoves each named range instead, which is the part of the complement that is expressible. Two coordinates along one dimension therefore both take their range out of it, leaving what neither removed.
Methods
| Name | Description |
|---|---|
| check | Refuse a patch which does not carry what the operation needs. |
| get_metadata | Return what selecting the complement of each range leaves. |
| kernel | Return the samples the query picks out. |
| model_copy | Copy the model, dropping cached values the update invalidates. |
| new | Create new instance with some attributed updated. |
| unselect | Return the patch outside a selection. |
| reconcile | Return metadata or a patch holding the final data; default as is. |
| run | Run the operation: check, get_metadata, kernel, reconcile, record. |