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

DM-5922: Rework camera geometry to use the replacement for XYTransform #89

Merged
merged 4 commits into from Sep 2, 2017

Conversation

r-owen
Copy link
Contributor

@r-owen r-owen commented Aug 14, 2017

No description provided.

@@ -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); " +
Copy link
Member

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?

Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Member

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.

@r-owen r-owen force-pushed the tickets/DM-5922 branch 3 times, most recently from 68060ad to 3b5e7b3 Compare August 14, 2017 18:12
Copy link
Member

@TallJimbo TallJimbo left a 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)
Copy link
Member

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.

Copy link
Contributor Author

@r-owen r-owen Aug 28, 2017

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.

@r-owen
Copy link
Contributor Author

r-owen commented Sep 1, 2017

I fixed the primary complaint (which was well justified) and am much happier with the code now.

@r-owen r-owen merged commit 2ba2574 into master Sep 2, 2017
@ktlim ktlim deleted the tickets/DM-5922 branch August 25, 2018 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants