You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,9 @@ Many image processing applications benefit from representing images at multiple
16
16
17
17
Implementation
18
18
**************
19
-
At the moment, this package generates an image pyramid by using the ``dask.array.coarsen`` (`docs <https://docs.dask.org/en/latest/array-api.html#dask.array.coarsen>`_) to apply a reducing function to contiguous, non-overlapping chunks of the input data. With this implementation, it is not possible to generate a "Gaussian" image pyramid (i.e., a sequence of images that are recursively smoothed with a Gaussian filter and then resampled) because this exceeds the capabilities of ``dask.array.coarsen``. Gaussian pyramid support might be added in the future.
19
+
The top-level function `multiscale` takes two main arguments: data to be downscaled, and a reduction function. The reduction function can use any implementation but it should (eagerly) take array data and a tuple of scale factors as inputs and return downscaled data as an output. See examples of reduction functions in `xarray_multiscale.reducers <https://github.com/JaneliaSciComp/xarray-multiscale/blob/main/src/xarray_multiscale/reducers.py>`_.
20
+
21
+
Note that the current implementation divides the input data into *contiguous* chunks. This means that attempting to use downscaling schemes based on sliding windowed smoothing will produce edge artifacts. Future versions of this package could enable applying the reduction function to *overlapping* chunks, which would enable more elaborate downscaling routines.
20
22
21
23
22
24
Usage
@@ -27,10 +29,10 @@ Generate a lazy multiscale representation of a numpy array:
27
29
.. code-block:: python
28
30
29
31
from xarray_multiscale import multiscale
30
-
import numpy as np
32
+
from xarray_multiscale.reducers import windowed_mean
31
33
32
34
data = np.arange(4)
33
-
multiscale(data, np.mean, (2,))
35
+
multiscale(data, windowed_mean, (2,))
34
36
35
37
which returns this (a collection of DataArrays, each with decreasing size):
36
38
@@ -53,15 +55,15 @@ Generate a lazy multiscale representation of an ``xarray.DataArray``:
53
55
.. code-block:: python
54
56
55
57
from xarray_multiscale import multiscale
56
-
import numpy as np
58
+
from xarray_multiscale.reducers import windowed_mean
0 commit comments