internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: scikit-image/scikit-image

Issue:
Inconsistent cython version requirements
## Description

setup.py requires cython >= 0.21 while skimage/_build.py requires >= 0.23.  Also, the two checks seem redundant.



Discussion:
Do you mind filing a pull request to fix it?

Sure.  The main reason I didn't is that my sense would be to remove the test in skimage/_build.py.  Also, I managed to build fine with cython 0.19, so I'm curious as to why 0.23 is required.

Are you sure you built the latest version?  We are using some features that were introduced after 0.19!

(Do a "make clean; make" to be sure)

Ah, so the tarball ships the .pyx files.  So do we actually need Cython installed then to build from that?

No, if you have the .pyx and .md5 files, you should be set.​


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -135,8 +135,6 @@ def configuration(parent_package='', top_path=None):
             'Operating System :: MacOS',
         ],
         install_requires=INSTALL_REQUIRES,
-        # install cython when running setup.py (source install)
-        setup_requires=['cython>=0.21'],
         requires=REQUIRES,
         packages=setuptools.find_packages(exclude=['doc']),
         include_package_data=True,
diff --git a/skimage/_build.py b/skimage/_build.py
--- a/skimage/_build.py
+++ b/skimage/_build.py
@@ -3,6 +3,8 @@
 import hashlib
 from distutils.version import LooseVersion
 
+CYTHON_VERSION = '0.23'
+
 # WindowsError is not defined on unix systems
 try:
     WindowsError
@@ -26,16 +28,21 @@ def cython(pyx_files, working_path=''):
 
     try:
         from Cython import __version__
-        if LooseVersion(__version__) < '0.23':
-            raise RuntimeError('Cython >= 0.23 needed to build scikit-image')
+        if LooseVersion(__version__) < CYTHON_VERSION:
+            raise RuntimeError('Cython >= %s needed to build scikit-image' % CYTHON_VERSION)
 
         from Cython.Build import cythonize
     except ImportError:
-        # If cython is not found, we do nothing -- the build will make use of
-        # the distributed .c files
-        print("Cython not found; falling back to pre-built %s"
-              % " ".join([f.replace('.pyx.in', 'c').replace('.pyx', '.c')
-                          for f in pyx_files]))
+        # If cython is not found, the build will make use of
+        # the distributed .c files if present
+        c_files = [f.replace('.pyx.in', '.c').replace('.pyx', '.c') for f in pyx_files]
+        for cfile in [os.path.join(working_path, f) for f in c_files]:
+            if not os.path.isfile(cfile):
+                raise RuntimeError('Cython >= %s is required to build scikit-image from git checkout' \
+                                   % CYTHON_VERSION)
+
+        print("Cython >= %s not found; falling back to pre-built %s" \
+              % (CYTHON_VERSION, " ".join(c_files)))
     else:
         for pyxfile in [os.path.join(working_path, f) for f in pyx_files]:
 


Test patch:
Repository: scikit-image/scikit-image

Issue:
Add example in gallery about downscaling/upscaling/resizing images
In the gallery, it would be interesting to add an example with the following functions:

* http://scikit-image.org/docs/stable/api/skimage.transform.html#downscale-local-mean
* http://scikit-image.org/docs/stable/api/skimage.transform.html#rescale
* http://scikit-image.org/docs/stable/api/skimage.transform.html#resize

If anyone is interested to make this contribution, that would be very useful I guess.

Could be added in the section "Geometrical transformations and registration"



Discussion:

Resolving patch:
diff --git a/doc/examples/transform/plot_rescale.py b/doc/examples/transform/plot_rescale.py
new file mode 100644
--- /dev/null
+++ b/doc/examples/transform/plot_rescale.py
@@ -0,0 +1,47 @@
+"""
+==============================
+Rescale, resize, and downscale
+==============================
+
+`Rescale` operation resizes an image by a given scaling factor.
+The scaling factor can either be a single floating point value,
+or multiple values - one along each axis.
+
+`Resize` serves the same purpose, but allows to specify an output
+image shape instead of a scaling factor.
+
+`Downscale` operation serves the purpose of downsampling an
+n-dimensional image by calculating local mean on the elements of
+each block of the size factors given as a parameter to the function.
+"""
+
+import matplotlib.pyplot as plt
+
+from skimage import data
+from skimage.transform import rescale, resize, downscale_local_mean
+
+image = data.camera()
+
+image_rescaled = rescale(image, 0.5)
+image_resized = resize(image, (400, 400), mode='reflect')
+image_downscaled = downscale_local_mean(image, (2, 3))
+
+fig, axes = plt.subplots(nrows=2, ncols=2,
+                         sharex=True, sharey=True)
+
+ax = axes.ravel()
+
+ax[0].imshow(image, cmap='gray')
+ax[0].set_title("Original image")
+
+ax[1].imshow(image_rescaled, cmap='gray')
+ax[1].set_title("Rescaled image")
+
+ax[2].imshow(image_resized, cmap='gray')
+ax[2].set_title("Resized image")
+
+ax[3].imshow(image_downscaled, cmap='gray')
+ax[3].set_title("Image downscaled using local averaging")
+
+plt.tight_layout()
+plt.show()


Test patch:
Repository: scikit-image/scikit-image

Issue:
module 'skimage.filters' has no attribute 'denoise_tv_chambolle' 
There are a couple of undefined symbols in [`filters` module](https://github.com/scikit-image/scikit-image/blob/master/skimage/filters/__init__.py#L46-L48)

Thus `from skimage.filters import *` gives:

```
AttributeError: module 'skimage.filters' has no attribute 'denoise_tv_chambolle'
```


Discussion:
@vspinu Thanks! Would you like to submit a patch?

Resolving patch:
diff --git a/skimage/filters/__init__.py b/skimage/filters/__init__.py
--- a/skimage/filters/__init__.py
+++ b/skimage/filters/__init__.py
@@ -43,9 +43,6 @@
            'roberts_pos_diag',
            'roberts_neg_diag',
            'laplace',
-           'denoise_tv_chambolle',
-           'denoise_bilateral',
-           'denoise_tv_bregman',
            'rank_order',
            'gabor_kernel',
            'gabor',


Test patch:
Repository: scikit-image/scikit-image

Issue:
marching_cubes_lewiner() with allow_degenerate=False gives data type error
## Description
see subject, I get 

```
skimage/measure/_marching_cubes_lewiner_cy.pyx in skimage.measure._marching_cubes_lewiner_cy.remove_degenerate_faces (skimage/measure/_marching_cubes_lewiner_cy.c:2920)()

ValueError: Buffer dtype mismatch, expected 'float' but got 'double'
```

## Way to reproduce
Everytime the allow_degenerate option is set to False. I am using Python 3.5.


Discussion:

Resolving patch:
diff --git a/skimage/measure/_marching_cubes_lewiner.py b/skimage/measure/_marching_cubes_lewiner.py
--- a/skimage/measure/_marching_cubes_lewiner.py
+++ b/skimage/measure/_marching_cubes_lewiner.py
@@ -172,7 +172,7 @@ def marching_cubes_lewiner(volume, level=None, spacing=(1., 1., 1.),
         return vertices, faces, normals, values
     else:
         fun = _marching_cubes_lewiner_cy.remove_degenerate_faces
-        return fun(vertices, faces, normals, values)
+        return fun(vertices.astype(np.float32), faces, normals, values)
 
 
 def _to_array(args):


Test patch:
diff --git a/skimage/measure/tests/test_marching_cubes.py b/skimage/measure/tests/test_marching_cubes.py
--- a/skimage/measure/tests/test_marching_cubes.py
+++ b/skimage/measure/tests/test_marching_cubes.py
@@ -42,6 +42,10 @@ def test_marching_cubes_anisotropic():
     # Test within 1.5% tolerance for anisotropic. Will always underestimate.
     assert surf > surf_calc and surf_calc > surf * 0.985
 
+    # Test spacing together with allow_degenerate=False
+    marching_cubes_lewiner(ellipsoid_anisotropic, 0, spacing=spacing,
+                           allow_degenerate=False)
+
 
 def test_invalid_input():
     # Classic
Repository: scikit-image/scikit-image

Issue:
docs build fails with numpydoc 0.7.0
## Description

If you just pip install numpydoc today and run 'make html' in doc you get:

```
reading sources... [  2%] api/skimage.data                                                                                                       
Exception occurred:
  File "/opt/opensource/deb/py36/venv3/lib/python3.5/site-packages/numpydoc/docscrape.py", line 343, in _parse
    raise ValueError(msg)
ValueError: The section Other Parameters appears twice in the docstring of None in None.
```

Installing numpydoc 0.6.0 gets past this problem.

I have no idea if this is a numpydoc or scikit-image bug really...



Discussion:
Oh the error makes sense, apart from the "none in none" bit, this fixes it:

```
--- a/skimage/io/_io.py
+++ b/skimage/io/_io.py
@@ -35,6 +35,8 @@
     ----------------
     flatten : bool
         Backward compatible keyword, superseded by `as_grey`.
+    plugin_args : keywords
+        Passed to the given plugin.
 
     Returns
     -------
@@ -42,12 +44,6 @@
         The different colour bands/channels are stored in the
         third dimension, such that a grey-image is MxN, an
         RGB-image MxNx3 and an RGBA-image MxNx4.
-
-    Other parameters
-    ----------------
-    plugin_args : keywords
-        Passed to the given plugin.
-
     """
     # Backward compatibility
     if flatten is not None:
```

Resolving patch:
diff --git a/skimage/io/_io.py b/skimage/io/_io.py
--- a/skimage/io/_io.py
+++ b/skimage/io/_io.py
@@ -36,6 +36,9 @@ def imread(fname, as_grey=False, plugin=None, flatten=None,
     flatten : bool
         Backward compatible keyword, superseded by `as_grey`.
 
+    plugin_args : keywords
+        Passed to the given plugin.
+
     Returns
     -------
     img_array : ndarray
@@ -43,11 +46,6 @@ def imread(fname, as_grey=False, plugin=None, flatten=None,
         third dimension, such that a grey-image is MxN, an
         RGB-image MxNx3 and an RGBA-image MxNx4.
 
-    Other parameters
-    ----------------
-    plugin_args : keywords
-        Passed to the given plugin.
-
     """
     # Backward compatibility
     if flatten is not None:


Test patch:
Repository: scikit-image/scikit-image

Issue:
Improve `skimage.feature.CENSURE` references
## Description
See https://github.com/scikit-image/scikit-image/blob/master/skimage/feature/censure.py#L148-L156 . The first reference is behind a pay-wall, the seconds one is broken.


Discussion:

Resolving patch:
diff --git a/skimage/feature/censure.py b/skimage/feature/censure.py
--- a/skimage/feature/censure.py
+++ b/skimage/feature/censure.py
@@ -148,12 +148,14 @@ class CENSURE(FeatureDetector):
     .. [1] Motilal Agrawal, Kurt Konolige and Morten Rufus Blas
            "CENSURE: Center Surround Extremas for Realtime Feature
            Detection and Matching",
-           http://link.springer.com/content/pdf/10.1007%2F978-3-540-88693-8_8.pdf
+           https://link.springer.com/chapter/10.1007/978-3-540-88693-8_8
+           DOI:10.1007/978-3-540-88693-8_8
 
     .. [2] Adam Schmidt, Marek Kraft, Michal Fularz and Zuzanna Domagala
            "Comparative Assessment of Point Feature Detectors and
            Descriptors in the Context of Robot Navigation"
-           http://www.jamris.org/01_2013/saveas.php?QUEST=JAMRIS_No01_2013_P_11-20.pdf
+           http://yadda.icm.edu.pl/yadda/element/bwmeta1.element.baztech-268aaf28-0faf-4872-a4df-7e2e61cb364c/c/Schmidt_comparative.pdf
+           DOI:10.1.1.465.1117
 
     Examples
     --------


Test patch:
Repository: scikit-image/scikit-image

Issue:
Deprecate and remove `skimage.novice`
`skimage.novice` was built by and for Software Carpentry.  I've recently learned that it is no longer being used, so I don't see much use for it remaining in the package.

If someone feels excited about turning it into a new package, please do so.


Discussion:
Two thumbs up for deprecation and removal.
@emmanuelle: Perhaps [adding the deprecation warning](http://scikit-image.org/docs/stable/contribute.html#deprecation-cycle) alone is easy? I would like to try it as my first time contribution at today's EuroPython coding sprint.
@jondo it should be pretty straightforward. It would be even better if you add a deprecation message also to the header of http://scikit-image.org/docs/stable/api/skimage.novice.html.
Yes, I thought it should be similar to [this depracation of sklearn/cross_validation.py](https://github.com/scikit-learn/scikit-learn/blob/65792205887c37316dd7da348179652d13e79b78/sklearn/cross_validation.py#L37).

Resolving patch:
diff --git a/skimage/novice/__init__.py b/skimage/novice/__init__.py
--- a/skimage/novice/__init__.py
+++ b/skimage/novice/__init__.py
@@ -96,7 +96,11 @@
 >>> picture.compare()  # doctest: +SKIP
 
 """
+import warnings
 from ._novice import Picture, open, colors, color_dict
 
 
+warnings.warn("This module was deprecated in version 0.14. "
+              "It will be removed in 0.16.")
+
 __all__ = ['Picture', 'open', 'colors', 'color_dict']


Test patch:
Repository: scikit-image/scikit-image

Issue:
Swirl center coordinates are reversed
```py
from skimage import data, transform, io

swirled = transform.swirl(
    image=data.text(),
    center=(224, 86),
    strength=5,
    mode='reflect',
)

io.imshow(swirled)
io.show()
```

This gives the correct result:

![figure_1](https://cloud.githubusercontent.com/assets/969983/23105342/b6952ec6-f6d5-11e6-93c2-12aed3fc95fe.png)

However, it shouldn't as the center coordinates are reversed. They are (column, row) but should be (row, column).


Discussion:
/xref #2397 
Mh, sounds like a complicated problem. Maybe we can at least fix the documentation in the meantime, or do you want to keep it broken in order to be able to fix it later instead of having to announce a breaking change by reversing the coordinates 😂🙈
Yes, monkey-covering-face-with-hands is about right :/  We'll get this sorted, but in the mean time kindly file a documentation patch.

Resolving patch:
diff --git a/skimage/transform/_warps.py b/skimage/transform/_warps.py
--- a/skimage/transform/_warps.py
+++ b/skimage/transform/_warps.py
@@ -394,7 +394,7 @@ def swirl(image, center=None, strength=1, radius=100, rotation=0,
     ----------
     image : ndarray
         Input image.
-    center : (row, column) tuple or (2,) ndarray, optional
+    center : (column, row) tuple or (2,) ndarray, optional
         Center coordinate of transformation.
     strength : float, optional
         The amount of swirling applied.
@@ -439,7 +439,7 @@ def swirl(image, center=None, strength=1, radius=100, rotation=0,
         mode = 'constant'
 
     if center is None:
-        center = np.array(image.shape)[:2] / 2
+        center = np.array(image.shape)[:2][::-1] / 2
 
     warp_args = {'center': center,
                  'rotation': rotation,


Test patch:
Repository: scikit-image/scikit-image

Issue:
`regioinprop.bbox_size` returns size of the original image

[This code](https://github.com/scikit-image/scikit-image/blob/master/skimage/measure/_regionprops.py#L125) returns the size of the original for all the regions.


Discussion:
Thank you. I confirm the bug.

Resolving patch:
diff --git a/skimage/measure/_regionprops.py b/skimage/measure/_regionprops.py
--- a/skimage/measure/_regionprops.py
+++ b/skimage/measure/_regionprops.py
@@ -123,7 +123,7 @@ def bbox(self):
                      [self._slice[i].stop for i in range(self._ndim)])
 
     def bbox_area(self):
-        return self._label_image.size
+        return self.image.size
 
     def centroid(self):
         return tuple(self.coords.mean(axis=0))


Test patch:
diff --git a/skimage/measure/tests/test_regionprops.py b/skimage/measure/tests/test_regionprops.py
--- a/skimage/measure/tests/test_regionprops.py
+++ b/skimage/measure/tests/test_regionprops.py
@@ -80,8 +80,9 @@ def test_bbox():
     assert_array_almost_equal(bbox, (1, 1, 1, 4, 3, 3))
 
 def test_bbox_area():
-    bbox_area = regionprops(SAMPLE)[0].bbox_area
-    assert_array_almost_equal(bbox_area, SAMPLE.shape[0] * SAMPLE.shape[1])
+    padded = np.pad(SAMPLE, 5, mode='constant')
+    bbox_area = regionprops(padded)[0].bbox_area
+    assert_array_almost_equal(bbox_area, SAMPLE.size)
 
 def test_moments_central():
     mu = regionprops(SAMPLE)[0].moments_central
Repository: scikit-image/scikit-image

Issue:
Allow specifying random seed for probabilistic_hough_line
The `probabilistic_hough_line` algorithm contains a call to `rand` from `libc.stdlib` in the cython code. Would it be possible to add a seed parameter to the function, so the random seed could be controlled when calling from python?


Discussion:
Yes, certainly; would you like to file a PR?
I'll have a go...

Resolving patch:
diff --git a/skimage/transform/hough_transform.py b/skimage/transform/hough_transform.py
--- a/skimage/transform/hough_transform.py
+++ b/skimage/transform/hough_transform.py
@@ -222,7 +222,7 @@ def hough_line(image, theta=None):
 
 
 def probabilistic_hough_line(image, threshold=10, line_length=50, line_gap=10,
-                             theta=None):
+                             theta=None, seed=None):
     """Return lines from a progressive probabilistic line Hough transform.
 
     Parameters
@@ -240,6 +240,8 @@ def probabilistic_hough_line(image, threshold=10, line_length=50, line_gap=10,
     theta : 1D ndarray, dtype=double, optional
         Angles at which to compute the transform, in radians.
         If None, use a range from -pi/2 to pi/2.
+    seed : int, optional
+        Seed to initialize the random number generator.
 
     Returns
     -------
@@ -261,7 +263,7 @@ def probabilistic_hough_line(image, threshold=10, line_length=50, line_gap=10,
         theta = np.pi / 2 - np.arange(180) / 180.0 * np.pi
 
     return _prob_hough_line(image, threshold=threshold, line_length=line_length,
-                            line_gap=line_gap, theta=theta)
+                            line_gap=line_gap, theta=theta, seed=seed)
 
 
 def hough_circle_peaks(hspaces, radii, min_xdistance=1, min_ydistance=1,


Test patch:
diff --git a/skimage/transform/tests/test_hough_transform.py b/skimage/transform/tests/test_hough_transform.py
--- a/skimage/transform/tests/test_hough_transform.py
+++ b/skimage/transform/tests/test_hough_transform.py
@@ -1,6 +1,8 @@
 import numpy as np
 
 from skimage import transform
+from skimage import data
+from skimage.feature import canny
 from skimage.draw import line, circle_perimeter, ellipse_perimeter
 
 from skimage._shared import testing
@@ -69,6 +71,17 @@ def test_probabilistic_hough():
     transform.probabilistic_hough_line(img, line_length=10, line_gap=3)
 
 
+def test_probabilistic_hough_seed():
+    # Load image that is likely to give a randomly varying number of lines
+    image = data.checkerboard()
+
+    # Use constant seed to ensure a deterministic output
+    lines = transform.probabilistic_hough_line(image, threshold=50,
+                                               line_length=50, line_gap=1,
+                                               seed=1234)
+    assert len(lines) == 64
+
+
 def test_probabilistic_hough_bad_input():
     img = np.zeros(100)
     img[10] = 1
Repository: scikit-image/scikit-image

Issue:
Images of type float must be between -1 and 1?
I convert lab image to rgb using lab2rgb in skimage. and the input datatype is float32, L is in range (0,100),
A is (-128,127), B is (-128,127).
but came across error: ValueError: Images of type float must be between -1 and 1.

 is the input datatype for color.lab2rgb in skimage uint8? or  are  there other problems... 


Discussion:
Hi @micklexqg!

Are you sure the error is coming from `lab2rgb`?

```python
In [56]: from skimage import color

In [57]: color.lab2rgb?

In [58]: color.lab2rgb([[[10., 10., 10.]]])
Out[58]: array([[[ 0.17178949,  0.08558054,  0.04875568]]])

In [59]: color.lab2rgb([[[10., -10., -10.]]])
Out[59]: array([[[ 0.      ,  0.124338,  0.159546]]])

In [60]: color.lab2rgb([[[-10., -10., -10.]]])
Out[60]: array([[[ 0.,  0.,  0.]]])
```

Could you come up with a small example that reproduces your error?

In many situations in skimage, such as converting between data types, float values are indeed restricted to [-1, 1], and [0, 1] more commonly. However this is not (or should not be) the case for lab2rgb or many other functions. See this documentation for more details on data types and data ranges:

http://scikit-image.org/docs/dev/user_guide/data_types.html
@jni ,thanks for your hint. and I find out the reason. the input datatype need to be float64 (mine is float32).
just as the following:
![image](https://user-images.githubusercontent.com/13776012/39564750-113b75c2-4ee8-11e8-8a7e-d19c40d8021e.png)



Whoa! Ok that's a real bug. Thanks @micklexqg! Will fix shortly!

Resolving patch:
diff --git a/skimage/util/dtype.py b/skimage/util/dtype.py
--- a/skimage/util/dtype.py
+++ b/skimage/util/dtype.py
@@ -240,14 +240,14 @@ def _scale(a, n, m, copy=True):
 
     # float -> any
     if kind_in == 'f':
-        if np.min(image) < -1.0 or np.max(image) > 1.0:
-            raise ValueError("Images of type float must be between -1 and 1.")
         if kind_out == 'f':
             # float -> float
             if itemsize_in > itemsize_out:
                 prec_loss()
             return image.astype(dtype_out)
 
+        if np.min(image) < -1.0 or np.max(image) > 1.0:
+            raise ValueError("Images of type float must be between -1 and 1.")
         # floating point -> integer
         prec_loss()
         # use float type that can represent output integer type


Test patch:
diff --git a/skimage/util/tests/test_dtype.py b/skimage/util/tests/test_dtype.py
--- a/skimage/util/tests/test_dtype.py
+++ b/skimage/util/tests/test_dtype.py
@@ -94,6 +94,11 @@ def test_float_out_of_range():
         img_as_int(too_low)
 
 
+def test_float_float_all_ranges():
+    arr_in = np.array([[-10., 10., 1e20]], dtype=np.float32)
+    np.testing.assert_all_close(img_as_float(arr_in), arr_in)
+
+
 def test_copy():
     x = np.array([1], dtype=np.float64)
     y = img_as_float(x)