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
DM-5922: Rework camera geometry to use the replacement for XYTransform #89
Conversation
@@ -53,8 +53,8 @@ class GaussianPsfFactory(Config): | |||
check=isPositive, | |||
) | |||
sizeFactor = Field( | |||
doc="Kernel size as a factor of fwhm (dimensionless); " | |||
+ "size = sizeFactor * fwhm; ignored if size is not None", | |||
doc = "Kernel size as a factor of fwhm (dimensionless); " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't think the spaces should be there for keyword args?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I don't think the space needs to be there at all does it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe spaces around = for keyword arguments are:
- encouraged for keyword arguments that are on their own line
- discouraged for other cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked, and @r-owen is correct according to the style guide. This makes me sad; I don't think whitespace around =
should be affected at all by how we split lines. But I also don't have the energy to RFC a change.
68060ad
to
3b5e7b3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One big comment here that's really a request to change a method name in afw (but the usage here neatly demonstrates the problem). Everything else is fine.
if detector is not None: | ||
tanSys = detector.makeCameraSys(TAN_PIXELS) | ||
pixToTanXYTransform = detector.getTransformMap().get(tanSys) | ||
pixToTanPix = detector.getTransform(TAN_PIXELS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I'm seeing this interface in action in real code, I'm a bit bothered by how difficult it is to see what's going on. This case is saved by the helpful pixToTanPix
variable name, but I think getTransform
should be replaced by a function that really says what's going on:
- what other coordinate system is involved ("PIXELS")?
- are we going from the given cordinate system ("TAN_PIXELS") to the implicit one ("PIXELS"), or the reverse?
To keep the meaning of the method the same, I'd recommend calling it something like getTransformFromPixelsTo(target)
. It's a lot more verbose, but a lot more readable.
Of course, this is all pre-existing, but it seems like a good time to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I'll make it detector.getTransform(fromSys, toSys)
. It's important to offer this, instead of using detector.getTransformMap().getTransform(fromSys, toSys)
because, unlike TransformMap, Detector accepts camera system prefixes, defaulting to the current detector.
I fixed the primary complaint (which was well justified) and am much happier with the code now. |
41b5a65
to
2ba2574
Compare
No description provided.