Skip to content

Commit

Permalink
DEP/MAINT: Remove downscale/skimage dependency (#865)
Browse files Browse the repository at this point in the history
Intent is to add back as a well thought out implementation that does not re-introduce skimage

Two options are presented in #862 and #863
  • Loading branch information
ksunden authored and untzag committed Jan 17, 2019
1 parent 3105c49 commit d9cda35
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 86 deletions.
60 changes: 0 additions & 60 deletions WrightTools/data/_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

import scipy
from scipy.interpolate import griddata, interp1d
from skimage.transform import downscale_local_mean

from .._group import Group
from .. import collection as wt_collection
Expand Down Expand Up @@ -894,60 +893,6 @@ def create_variable(
self.attrs["variable_names"] = np.append(self.attrs["variable_names"], name.encode())
return variable

def downscale(self, tup, name=None, parent=None) -> "Data":
"""Down sample the data array using local averaging.
See `skimage.transform.downscale_local_mean`__ for more info.
__ http://scikit-image.org/docs/0.12.x/api/
skimage.transform.html#skimage.transform.downscale_local_mean
Parameters
----------
tup : tuple of ints
The collection of step sizes by which each axis is binned.
Each axis is sliced with step size determined by the tuple.
To keep an axis sampling unchanged, use 1 or None
name : string (optional)
The name of the string. Default is None.
parent : WrightTools Collection instance (optional)
Collection to place the downscaled data object. Default is
None (new parent).
Returns
-------
WrightTools Data instance
New data object with the downscaled channels and axes
See Also
--------
zoom
Zoom the data array using spline interpolation of the requested order.
"""
if name is None:
name = self.natural_name + "_downscaled"
if parent is None:
newdata = Data(name=name)
else:
parent.create_data(name=name)

for channel in self.channels:
name = channel.natural_name
newdata.create_channel(
name=name, values=downscale_local_mean(channel[:], tup), units=channel.units
)
args = []
for i, axis in enumerate(self.axes):
if len(axis.variables) > 1:
raise NotImplementedError("downscale only works with simple axes currently")
variable = axis.variables[0]
name = variable.natural_name
args.append(name)
slices = [slice(None, None, step) for step in tup]
newdata.create_variable(name=name, values=variable[slices], units=variable.units)
newdata.transform(*args)
return newdata

def get_nadir(self, channel=0) -> tuple:
"""Get the coordinates, in units, of the minimum in a channel.
Expand Down Expand Up @@ -1932,11 +1877,6 @@ def zoom(self, factor, order=1, verbose=True):
The order of the spline used to interpolate onto new points.
verbose : bool (optional)
Toggle talkback. Default is True.
See Also
--------
downscale
Down-sample the data array using local averaging.
"""
raise NotImplementedError
import scipy.ndimage
Expand Down
1 change: 0 additions & 1 deletion docs/api/WrightTools.data.Data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ WrightTools.data.Data
~Data.create_dataset
~Data.create_group
~Data.create_variable
~Data.downscale
~Data.flush
~Data.get
~Data.get_nadir
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def read(fname):
setup_requires=["pytest-runner"],
tests_require=["pytest", "pytest-cov", "sphinx", "sphinx-gallery==0.1.12", "sphinx-rtd-theme"],
install_requires=[
"scikit-image",
"h5py",
"imageio",
"matplotlib>=3.0",
Expand Down
24 changes: 0 additions & 24 deletions tests/data/downscale.py

This file was deleted.

0 comments on commit d9cda35

Please sign in to comment.