Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docstring for SimilarityTransform. #7194

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions skimage/transform/_geometric.py
Original file line number Diff line number Diff line change
Expand Up @@ -1352,8 +1352,8 @@ class SimilarityTransform(EuclideanTransform):
Rotation angle, clockwise, as radians.
Implemented only for 2D and 3D. For 3D, this is given in ZYX Euler
angles.
translation : (dim,) array_like, optional
x, y[, z] translation parameters. Implemented only for 2D and 3D.
translation : (x, y[, z, ...]) sequence of float, length D, optional
Translation parameters for each axis. Implemented only for 2D and 3D.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that D (as in "length D") is used to mean n, i.e., the image's number of dimensions. We write "an nD image" so n takes values 2, 3, ... (not D).

I don't mind updating this to "n" or "N". Though I do notice that translation is only supported for 2D and 3D. So the ... should be removed as specifying more than xyz wouldn't work?

params : (dim+1, dim+1) (below) should also be updated according to whatever we agree on here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, thanks @lagru.

We can't use N because this already denotes something else (number of points):

points : (N, D) array

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find D (Dimensionality) to be much clearer than n, particularly when next to N (Number of points)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scott-vsi I hear you. Have you scanned the other modules to see which usage would currently dominate? Should we update "nD image" everywhere with "D-dim image?" In a sentence, "nD image" seems much more natural though...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, nD reads better, although it looks like n-D and N-D are also used pretty commonly (there are actually not that many uses of nD. I could see changing those to n-D or N-D).

skimage is a large package, so I doubt you could ever get complete consensus, but it looks like D dominates for the dimensionality of the image. It is used in skimage._shared.utils.check_nD, skimage.measure._moments.moments_coords, skimage.measure._regionprops_utils.euler_number, and skimage.feature.template.match_template. And that is just from a quick spot check.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this, @scott-vsi! I'll mark this PR as draft, because I realize some discussion is needed before we can move forward.

I could see changing those to n-D or N-D

I would avoid uppercase N because, in addition to number of points #7194 (comment), this notation is also used for number of columns, e.g.:

src : (M, N) array_like


Attributes
----------
Expand Down