diff --git a/README.md b/README.md index 2a92c3b..bfe46d6 100644 --- a/README.md +++ b/README.md @@ -43,17 +43,6 @@ or from this distribution with $ python setup.py install ``` -## Performance: Optional - -This library is optionally compatible with [bottleneck](https://github.com/pydata/bottleneck) and may offer performance improvements in some cases. -Install bottleneck in your project as a peer to astroalign using: - -```bash -pip install bottleneck -``` - -`Astroalign` will pick this optional dependency up and use it's performance improved functions for computing transforms. - ## Running Tests ```bash diff --git a/astroalign.py b/astroalign.py index d6d3fef..411b479 100644 --- a/astroalign.py +++ b/astroalign.py @@ -56,13 +56,6 @@ "register", ] -try: - import bottleneck as bn -except ImportError: - HAS_BOTTLENECK = False -else: - HAS_BOTTLENECK = True - import numpy as _np @@ -109,26 +102,6 @@ def matrix_transform(*args, **kwargs): Default: 5 """ -_default_median = bn.nanmedian if HAS_BOTTLENECK else _np.nanmedian # pragma: no cover -""" -Default median function when/if optional bottleneck is available -""" - -_default_average = bn.nanmean if HAS_BOTTLENECK else _np.nanmean # pragma: no cover -""" -Default mean function when/if optional bottleneck is available -""" - -_default_sum = bn.nansum if HAS_BOTTLENECK else _np.nansum # pragma: no cover -""" -Default sum function when/if optional bottleneck is available -""" - -_default_std = bn.nanstd if HAS_BOTTLENECK else _np.nanstd # pragma: no cover -""" -Default std deviation function when/if optional bottleneck is available -""" - def _invariantfeatures(x1, x2, x3): """Given 3 points x1, x2, x3, return the invariant features for the set.""" @@ -270,7 +243,7 @@ def _bw(image): """Return a 2D numpy array for an array of arbitrary channels.""" if image.ndim == 2: return image - return _default_average(image, axis=-1) + return _np.mean(image, axis=-1) def _shape(image): @@ -471,7 +444,7 @@ def apply_transform( output_shape=target_shape, order=3, mode="constant", - cval=_default_median(source_data), + cval=_np.median(source_data), clip=True, preserve_range=True, ) diff --git a/docs/index.rst b/docs/index.rst index 8aff2e6..8bdb82e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -29,10 +29,6 @@ You can find a Jupyter notebook example with the main features at http://quatrop If your images contain a large number of hot pixels, this may result in an incorrect registration. Please refer to the tutorial for how to solve this problem using `CCDProc's cosmic-ray remover `_. -.. note:: - This library is compatible with `bottleneck `_ and may offer performance improvements in some cases. - `Astroalign` will pick this optional dependency up and use its performance improved ``mean`` and ``median`` functions. - Citation -------- diff --git a/pyproject.toml b/pyproject.toml index 53f54b3..4e18b6e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,10 +20,6 @@ keywords = [ "stellar-astronomical-images" ] - -[project.optional-dependencies] -bottleneck = ["bottleneck"] - [project.urls] homepage = "https://astroalign.quatrope.org" documentation = "https://astroalign.readthedocs.io/"