split

method of dascore.core.spool.BaseSpool source

split(
    self ,
    size: int | None[int, None] = None,
    count: int | None[int, None] = None,
)-> ‘Generator[Self, None, None]’

Yield sub-patches based on specified parameters.

Parameters

Parameter Description
size The number of patches desired in each output spool. The last
spool may have fewer patches.
count The number of spools to include. If count is greater than
the length of the spool then the output will be smaller than
count, with one patch per spool.

Examples

import dascore as dc
spool = dc.get_example_spool("diverse_das")
# split spool into list of spools each with 3 patches.
split = spool.split(size=3)
# split spool into 3 evenly sized (if possible) spools
split = spool.split(count=3)