chunks¶
- emlib.numpytools.chunks(data, chunksize, hop=None, padwith=None)[source]¶
Iterate over data in chunks of chunksize. Returns a generator
- Parameters:
data (
ndarray
) – the array to be iterated in chunkschunksize (
int
) – the size of each chunkhop (
Optional
[int
]) – the amount of elements to skip between chunkspadwith (
Optional
[int
]) – value to pad when a chunk is not big enough, None to avoid padding
- Return type:
Iterator
[ndarray
]- Returns:
a generator with chunks of data of chunksize or less