-
Notifications
You must be signed in to change notification settings - Fork 0
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
round guide count and P2 #378
Conversation
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.
Looks good to me. _guide_count looks to be explicitly returning a float, and the P2 from proseco_probs is explicitly a float, so the sprintf behavior should round it. In the absence of unit tests I generally just try to find weeks that show what we want for functional tests.
So the NOV1521A functional test shows that the bright guide count is working. I figure we probably also want functional test coverage of the OR guide count and P2, or could let them go... |
What do you mean by "functional test coverage of the OR guide count and P2"? Wouldn't that show up in the same output? I posted a diff file to make it easier. |
the OR guide count is already rounded in the output, it seems, so there is no associated diff. |
Right, and for the P2 it seems like we should probably update the format string for the print as well (unless the zeros are now reassuring). |
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.
Overall the use of sprintf
to do rounding and turn the value into a string really seems horrible. But this is perl and after a bit of googling that does seem to be the idiom. So 👍 on this. The question is just about functional testing and interface changes.
And speaking of which, is this a good time to include the guide count in the starcheck per-obsid report instead of just in the summary up top?.
@@ -2269,7 +2269,7 @@ sub print_report { | |||
my $bad_FOM = $self->{figure_of_merit}->{cum_prob_bad}; | |||
$o .= "$red_font_start" if $bad_FOM; | |||
$o .= "Probability of acquiring 2 or fewer stars (10^-x):\t"; | |||
$o .= substr(sprintf("%.4f", $self->{figure_of_merit}->{P2}), 0, 6) . "\t"; | |||
$o .= substr(sprintf("%.1f", $self->{figure_of_merit}->{P2}), 0, 3) . "\t"; |
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.
What is the substr
for here? I see the logic in the change but the original code is confusing me.
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 am betting this can be removed.
I can imagine something like this to truncate the number if the rounded number takes more digits than expected, but it is also not a very good idea.
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.
this could related to sprintf actually rounding a float and not giving a string as output. When you round, you might not get a number with exact binary representation, and then when you concatenate and print you get 0.9000001 instead of 0.9, so you truncate the string.
(although I think what I just said would be crazy, I doubt that can be, can 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.
As long as I'm trying out perl... I feel like the substr
is not helping out here. In the unlikely event that P2 is > 10 or negative, the substr
would give a bad result.
perl -e '$a="10.23432"; $b=substr($a, 0, 3); print("$b\n")'
10.
I also do not like the use of |
Agreed. And I commented on the inputs being floats because I seemed to remember that was the "gotcha" with using sprintf this way (I don't think it rounds if they are already strings)... but I didn't test. |
Looks like it works...
|
I think your example is not super reassuring, but agree that sprintf looks to round correctly even if the thingy is already a string (I suppose that makes sense it needs to cast to print the float with decimal places anyway).
Good perl reminder. |
Wrt "And speaking of which, is this a good time to include the guide count in the starcheck per-obsid report instead of just in the summary up top?." I went ahead and did that in some commits in this PR after Javier's. I also just added the guide count to the per-obsid stuff at the bottom. It turns out that chunk is not parsed by the parser anyway, so seems not a problem/complication. |
I put updated output at https://icxc.cfa.harvard.edu/aspect/tmp/starcheck-pr378-v2/starcheck.html and https://icxc.cfa.harvard.edu/aspect/tmp/starcheck-pr378-v2/diff.html though I note we run into the little issue that as it gets further from NOV1521, we get more critical warnings on magnitude mismatches as the supplement has updated. There might be value in adding an option to starcheck to use the mags from previous starcheck outputs. (just disabling the supplement seems not the right thing and keeping the critical warning still seems safe). |
What about outputting the ER guide star count which has been the driver here? |
About |
Good point about the ER bright star count. I was missing that tree in this forest. So, do we want that in the two places, the summary at top and the standard matter at the bottom of an obsid (though this one would only be for ERs or we could include the ER bright star count on ERs and the OR guide count for ORs). |
I don't feel strongly about demoting the guide mag diff critical, just because it shouldn't come up in flight products. For test work, demoting the warning doesn't fix the problem. |
I don't think we need to put the ER count in the summary, but I do think we should have both the ER count and the regular count in the detail text for ERs since both are checked (IIRC?). |
Well at least it would let us pass test products without a Note related to this issue. |
If the note were based on the diff of all warnings... demoting wouldn't really help... but if it is your preference that's fine. |
OK. I added the count of bright guide stars to the ER standard reporting. |
Can you make the latest output available somewhere? The top description should be updated with relevant permalinks for the functional testing / evaluation. |
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.
Looks basically OK apart from the one comment, but I'd like to see the output and diff.
The output and diff through 8d9e865 are now in https://icxc.cfa.harvard.edu/aspect/tmp/starcheck-pr378-v3/ (functional testing comment at top updated). Still not sure if you want to call count_guide_stars() again for the summary check; could go either way on that. |
And @javierggt I apparently can't ask for your review because it is your PR but... |
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.
Looks good to me.
Description
This PR adds changes to round P2 and guide count so we do not get warnings due to numerical errors (like we got in NOV1521A.
Testing