-
Notifications
You must be signed in to change notification settings - Fork 6
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-15008: anetAstrometry.py uses self.distortionContext, which does not exist #11
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7ba677b
git hide .coverage
r-owen 44497a4
Remove obsolete reference to distortionContext
r-owen 8def5fb
Remove obsolete reference to wcs.hasDistortion()
r-owen 4b87720
Use updateSourceCoords
r-owen 7c0a5ed
Add cleanBadPoints.py to this package
r-owen 77a9b18
Fix sigma-0 bug in `clean`
r-owen 67b4993
Add a basic unit test for ANetAstrometryTask
r-owen 7f16872
Pass log args separately in ANetAstrometryTask
r-owen File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
By no means is this necessary, but it would be nice to see either a format method used here or a python f string
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.
Note that this would also work with
,
instead of%
and no tuple around the formatting arguments (i.e. just make them extra arguments tolog.info
). Our loggers can do the formatting themselves.That's how it's usually done in Python, but I'm not sure it's actually better (it is in C++, where the ability to skip the formatting when that logger is disabled is important).
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.
Unfortunately
{}
formatting doesn't work withlsst.log
when the arguments are provided separately, and in my opinion that's a useful enough feature to justify using the older style formatting. I have updated the existing log messages to pass the arguments separately, in case it speeds things up if the message is not printed.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.
Yes it does. Use
log.infof()
.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.
Im confused, how does that not work, as format is a method on the string itself, so log.info should only ever see that a string was passed into the function call. The final string should have already been realized at that point.
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.
The point is that I want to pass the arguments separately and let log apply them if and only if the message is to be logged.
log.info
handles%
formatting that way. Apparentlylog.infof
handles{}
formatting but I've already updated the code to pass the arguments separately tolog.info
and the like, and plan to leave it at that. This package is under consideration for being retired anyway, and I don't want to spend more time on it (especially making changes that might break something).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.
@r-owen, I think the confusion here (for me at least) is just coming from the fact that you now have an actual
%
between your string and the arguments you want to insert into it, so you aren't actually letting the logger apply them conditionally. Continuing with%
-style logging via the logger still seems fine to me; we certainly haven't made any statements about trying to phase that out, despite the new options available.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 with @TallJimbo that the idiom for
log.info
is to use%
-formatting syntax but not do the formatting. Remove the%
and the tuple and have the extra items to be formatted as normal arguments.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'll try to be clearer. I agreed with @TallJimbo that it's better to let the logger do the formatting, so I pushed a commit that changes all logging messages in this task to do that. I chose to retain the
%
formatting codes in the message strings, rather than change to{...}
in the message strings and calling thef
suffix methods such aslog.infof
. Please look at the new code instead of the snippet above, which is outdated.