Repository navigation
Fix example section in docstring of skimage.feature.graycomatrix - #7297
Conversation
…n matches the example code.
|
Thank you, @FedericoWZhaw! May I ask that you wrap the line at 88 characters? I'm actually surprised that pre-commit passed... scikit-image/.pre-commit-config.yaml Line 35 in f4c1b34 |
Done |
| Compute 2 GLCMs: One for a 1-pixel offset to the right, and one | ||
| for a 1-pixel offset upwards. | ||
| Compute 4 GLCMs at 1-pixel offset for 4 different angles. For example, 0 radians | ||
| refers to the pixel to the right and pi/2 to the pixel above. |
There was a problem hiding this comment.
Thank you, @FedericoWZhaw! I would be a little more explicit; maybe:
Compute 4 GLCMs: The first one for a 1-pixel offset to the right (distance 1 and angle 0 rad); the second one for a 1-pixel offset to the first bisector (distance 1 and angle pi/4); etc.
or include it as comments in the code, when each GLCM is printed. Is it correct that pi/4 and 3*pi/4 correspond to the upward diagonal directions?
There was a problem hiding this comment.
"1-pixel offset" and "distance 1" seem somewhat redundant, I find the later more precise? "bisector" seems like a very technical term that's not used anywhere else in the docstring..?
There was a problem hiding this comment.
"1-pixel offset" and "distance 1" seem somewhat redundant, I find the later more precise?
The description of the distance parameter states:
distances : array_like
List of pixel pair distance offsets.
What about:
"Compute 4 GLCMs using 1-pixel distance and 4 different angles. For example, an angle of 0 radians refers to the neighboring pixel to the right; pi/4 to the top-right diagonal neighbor (row-1,column+1); pi/2 to the pixel above, etc."
Feel free to suggest something else.
There was a problem hiding this comment.
Thank you both for iterating! 😃
"1-pixel offset" and "distance 1" seem somewhat redundant
Totally, but that was on purpose, to clarify the arguments, as done in the text of the gallery example: "a 1-pixel offset to the right (distance 1 and angle 0 rad)" parallels "a horizontal offset of 5 (distance=[5] and angles=[0])."
"bisector" seems like a very technical term
I must say I'm not sure how it sound to most ears... I would assume that someone using scikit-image would have some minimal computing background and, for instance, would have already heard something like "the equation of the first bisector line is y=x" (but I'm definitely not attached to this term).
I very much like @FedericoWZhaw's suggestion (minor: I would write "0 radian" instead of "0 radians"). It's just that -- and that was my original motivation for suggesting a change -- an angle refers to a direction so, e.g., an angle of 0 refers to all pixels to the right, not only to the pixel to the right; the fact that it's the pixel to the right comes from the pair (distance=1, angle=0); same with all other angles (angle pi/2 means one of the pixels straight above, and it's the pixel right above because it's at distance 1).
|
@FedericoWZhaw are you able to wrap this up? Or would you like us to take over and co-author a third/final commit? Thanks! |
Thanks for the inputs and the interesting discussion! Since it is not fully clear to me if we want to go for a variant of : "Compute 4 GLCMs using 1-pixel distance and 4 different angles. For example, an angle of 0 radians refers to the neighboring pixel to the right; pi/4 to the top-right diagonal neighbor (row-1,column+1); pi/2 to the pixel above, etc." or "Compute 4 GLCMs: The first one for a 1-pixel offset to the right (distance 1 and angle 0 rad); the second one for a 1-pixel offset to the first bisector (distance 1 and angle pi/4); etc." I think it's best you take over the final commit, that should be the fastest solution. |
|
It would be helpful to add a sentence to explicitly state what each of the four co-occurrence matrices represent. We could do that as a follow-up PR. |
| Compute 2 GLCMs: One for a 1-pixel offset to the right, and one | ||
| for a 1-pixel offset upwards. | ||
| Compute 4 GLCMs using 1-pixel distance and 4 different angles. For example, | ||
| an angle of 0 radians refers to the neighboring pixel to the right; |
There was a problem hiding this comment.
| an angle of 0 radians refers to the neighboring pixel to the right; | |
| an angle of 0 radian refers to the neighboring pixel to the right; |
There was a problem hiding this comment.
I used "radians" intentionally since that's the convention I found on https://en.wikipedia.org/wiki/Radian. My logic is that anything that's not precisely 1 radian, should be plural. But I don't feel strongly at all about this.
I'll leave the decision to you since you are often more informed on things like this. 😉
There was a problem hiding this comment.
Oh, thanks for the reference (although I definitely don't consider Wikipedia to be the ultimate reference)! I have quickly searched the page but couldn't find any instance of "0 radians" nor "zero radians" though...
The logic/grammar is that the plural applies to quantities > 1 (that's what I remember learning in fourth grade, but we could probably find written references).
There was a problem hiding this comment.
I'd say that's the more common form in English: 5 degrees Celcius, 2 radians, etc., even though my physics professor hated it 😅
|
I wonder what this error could be about: [skimage_extensions] created D:\a\1\s\doc\build\html\_static\random.js with 0 possible targets
Warning, treated as error:
Summarised items should not include the current module. Replace 'skimage.color' with 'color'. [autosummary.import_cycle]
make: *** [Makefile:50: html] Error 2
make: Leaving directory 'D:/a/1/s/doc'Apparently that's when CI builds the docs, it finishes properly with |
|
Re-running should bring in Sphinx 7.4.6, which may be enough! |
Apparently it didn't (I re-ran from the DevOps dashboard). I'll merge anyway, since the issue is unrelated (to this PR) and has a fix in the pipeline. Thanks! |
|
Hi @stefanv / @mkcor -- if at all possible, would you be able to test with sphinx-doc/sphinx#12626? ( Hopefully it should fix the issue here, which I believe is with A |
|
Hi @AA-Turner, I'm getting |
|
Perhaps as that PR has been merged? Try A |
|
Thanks, @AA-Turner, this install worked. Unfortunately, I'm getting the same error as with 7.4.5 and 7.4.6, i.e., Warning, treated as error:
Summarised items should not include the current module. Replace 'skimage.color' with 'color'.
[autosummary.import_cycle]
make: *** [Makefile:50: html] Error 2 |
skimage.feature.graycomatrix
Fixed documentation according to #7293