Skip to content

Support sliding window computations #4659

@pentschev

Description

@pentschev

Consider the following code:

import dask.array as da
import numpy as np

d = da.arange(8, chunks=4)

g = d.map_overlap(np.mean, depth=0, boundary=0, trim=False, keepdims=True)

After computing g, this will return the mean of the two chunks [0:4] and [4:8]. Currently, there seems to be no way to specify a step size different (smaller) than the chunk size for each dimension. One could want a step size of 2, result in the mean for ranges [0:4], [2:6], [4:8].

Being able to specify a step size is very useful for filtering images, for example, as the user may be fine with computing every the filter for only every second or third pixel to reduce compute time. The user may want an arbitrary step size, which I think will normally be anything from 1..len(chunk[dim]).

I would be interesting in knowing what options do we currently have (if any), otherwise, what people think may be a good direction for the implementation of a step size.

cc @mrocklin @jakirkham

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions