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

Add up NMM time before NPNT states to calculate maneuver equiv angle #432

Merged
merged 18 commits into from
Dec 28, 2023

Conversation

jeanconn
Copy link
Contributor

@jeanconn jeanconn commented Oct 19, 2023

Description

For each NPNT state, add up the time in NMM before that state to calculate a maneuver angle "equivalent". This is used in the proseco reconstructed acquisition catalog for those checks and it is printed if it differs by more than 5 degrees from the maneuver angle of the actual maneuver to the NPNT state.

We retired this idea, but with the segmented maneuvers, I find the calculated maneuver angle output reassuring and this code seems overall benign.

This code also moves the ir_zone code into a new file (not 100% sold on the name of that file) with this new angle calculation code.

And while in there, updated the report output for the high ir zone checker to print what it is doing in minutes.

Fixes #435

Interface impacts

Testing

Unit tests

Independent check of unit tests by @taldcroft

  • Mac

Functional tests

Added some unit tests of the parts of the new code.

Regression test weeks in

https://icxc.cfa.harvard.edu/aspect/test_review_outputs/starcheck/starcheck-pr432/

I ran all weeks back to 2020:001 to look for anomalous behavior in the diffs, but then reduced the set to the recent two-week load and schedules that show new critical warnings with this PR. The output in there is the product of this script, where the PR code (from sandbox_starcheck) was run from a ska3-masters on fido.

touch combined_diff.txt

/home/jeanconn/git/starcheck/sandbox_starcheck -dir /data/mpcrit1/mplogs/2023/DEC2523/oflsb -out DEC2523b_test
starcheck -dir /data/mpcrit1/mplogs/2023/DEC2523/oflsb -out DEC2523b_master
/proj/sot/ska/bin/diff2html DEC2523b_master.txt DEC2523b_test.txt > DEC2523b_diff.html
echo ---------------------------------------- >> combined_diff.txt
echo "week = DEC2523b" >> combined_diff.txt
diff -u DEC2523b_master.txt DEC2523b_test.txt >> combined_diff.txt

/home/jeanconn/git/starcheck/sandbox_starcheck -dir /data/mpcrit1/mplogs/2023/MAY2923/oflsa -out MAY2923a_test
starcheck -dir /data/mpcrit1/mplogs/2023/MAY2923/oflsa -out MAY2923a_master
/proj/sot/ska/bin/diff2html MAY2923a_master.txt MAY2923a_test.txt > MAY2923a_diff.html
echo ---------------------------------------- >> combined_diff.txt
echo "week = MAY2923a" >> combined_diff.txt
diff -u MAY2923a_master.txt MAY2923a_test.txt >> combined_diff.txt

/home/jeanconn/git/starcheck/sandbox_starcheck -dir /data/mpcrit1/mplogs/2023/APR0323/oflsa -out APR0323a_test
starcheck -dir /data/mpcrit1/mplogs/2023/APR0323/oflsa -out APR0323a_master
/proj/sot/ska/bin/diff2html APR0323a_master.txt APR0323a_test.txt > APR0323a_diff.html
echo ---------------------------------------- >> combined_diff.txt
echo "week = APR0323a" >> combined_diff.txt
diff -u APR0323a_master.txt APR0323a_test.txt >> combined_diff.txt

/home/jeanconn/git/starcheck/sandbox_starcheck -dir /data/mpcrit1/mplogs/2022/MAY2322/oflsa -out MAY2322a_test
starcheck -dir /data/mpcrit1/mplogs/2022/MAY2322/oflsa -out MAY2322a_master
/proj/sot/ska/bin/diff2html MAY2322a_master.txt MAY2322a_test.txt > MAY2322a_diff.html
echo ---------------------------------------- >> combined_diff.txt
echo "week = MAY2322a" >> combined_diff.txt
diff -u MAY2322a_master.txt MAY2322a_test.txt >> combined_diff.txt

Review of the new CRITICAL warnings shows that they are all due to time newly "counted" in NMM that was not counted at the time of review:

Obsid 44657 has a non-zero (manual) MANSTART=000:00:10:50.600 .
https://icxc.cfa.harvard.edu/aspect/test_review_outputs/starcheck/starcheck-pr432/APR0323a_test.html#obsid44657

Obsid 25816 has a non-zero MANSTART=000:00:12:05.706
https://icxc.cfa.harvard.edu/aspect/test_review_outputs/starcheck/starcheck-pr432/MAY2322a_test.html#obsid25816

Obsid 44464 has a non-zero MANSTART=000:00:07:18.574
https://icxc.cfa.harvard.edu/aspect/test_review_outputs/starcheck/starcheck-pr432/MAY2923a_test.html#obsid44464

These functional tests were run at 47a15af

starcheck/state_checks.py Outdated Show resolved Hide resolved
@jeanconn jeanconn marked this pull request as ready for review November 28, 2023 19:03
@jeanconn jeanconn changed the title WIP: Add up nmm Add up nmm time before npnt states to calculate maneuver equiv angle Nov 28, 2023
@jeanconn jeanconn requested a review from taldcroft November 28, 2023 19:04
@taldcroft taldcroft changed the title Add up nmm time before npnt states to calculate maneuver equiv angle Add up NMM time before NPNT states to calculate maneuver equiv angle Nov 29, 2023
Copy link
Member

@taldcroft taldcroft left a comment

Choose a reason for hiding this comment

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

Looks generally good!

I wonder if we want to add the effective maneuver angle to the starcheck output, or maybe only if it is different from the actual by more than a couple degrees? [EDIT, already done! But maybe with a tighter tolerance.]

There is also the opportunity to cross-check the angle in the proseco pickle vs the effective man angle.

starcheck/state_checks.py Outdated Show resolved Hide resolved
starcheck/state_checks.py Outdated Show resolved Hide resolved
starcheck/state_checks.py Outdated Show resolved Hide resolved
starcheck/state_checks.py Outdated Show resolved Hide resolved
starcheck/state_checks.py Outdated Show resolved Hide resolved
starcheck/state_checks.py Outdated Show resolved Hide resolved
starcheck/state_checks.py Outdated Show resolved Hide resolved
starcheck/state_checks.py Outdated Show resolved Hide resolved
starcheck/state_checks.py Outdated Show resolved Hide resolved
starcheck/state_checks.py Outdated Show resolved Hide resolved
Copy link
Member

@taldcroft taldcroft left a comment

Choose a reason for hiding this comment

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

This all looks good pending the update to the high-IR zone text. Thanks!

@jeanconn
Copy link
Contributor Author

The plan is to squash and merge this when I've updated the functional test outputs. I should also add an issue to skare3_tools referencing this PR as an example of a squash and merge for tracking.

# To satisfy those goals, use the derived-from-NMM-time angle if it is more than 5 degrees
# different from the actual maneuver angle. Otherwise use the actual maneuver angle.
# This also lines up with what is printed in the starcheck maneuver output.
my $man_angle = (abs($targ_cmd->{man_angle_calc} - $targ_cmd->{angle}) > 5)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@taldcroft Does this work for you? It is a substantive update since your approval. I'm rerunning functional review with it in place. To be fully conservative I suppose the other option would be to use the angle-from-nmm-time only if 5 or more degrees greater than the maneuver angle (instead of just different).

Copy link
Member

Choose a reason for hiding this comment

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

If the angle-from-nmm-time is more than 5 degrees SMALLER than the maneuver angle, that would indicate a bug in the code somewhere. In that case there should be a critical warning and the review should use the maneuver angle.

Copy link
Member

Choose a reason for hiding this comment

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

Nice comment BTW!!

@jeanconn
Copy link
Contributor Author

I think you were more than done with this @taldcroft but I re-requested review just because there were some substantive changes.

# To satisfy those goals, use the derived-from-NMM-time angle if it is more than 5 degrees
# different from the actual maneuver angle. Otherwise use the actual maneuver angle.
# This also lines up with what is printed in the starcheck maneuver output.
my $man_angle = (abs($targ_cmd->{man_angle_calc} - $targ_cmd->{angle}) > 5)
Copy link
Member

Choose a reason for hiding this comment

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

If the angle-from-nmm-time is more than 5 degrees SMALLER than the maneuver angle, that would indicate a bug in the code somewhere. In that case there should be a critical warning and the review should use the maneuver angle.

# To satisfy those goals, use the derived-from-NMM-time angle if it is more than 5 degrees
# different from the actual maneuver angle. Otherwise use the actual maneuver angle.
# This also lines up with what is printed in the starcheck maneuver output.
my $man_angle = (abs($targ_cmd->{man_angle_calc} - $targ_cmd->{angle}) > 5)
Copy link
Member

Choose a reason for hiding this comment

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

Nice comment BTW!!

@@ -3038,7 +3064,7 @@ sub proseco_args {
0 + $targ_cmd->{q3},
0 + $targ_cmd->{q4}
],
man_angle => 0 + $targ_cmd->{angle},
man_angle => 0 + $man_angle,
Copy link
Member

Choose a reason for hiding this comment

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

What a silly language with the 0 + something.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some of this could probably go away -- I played some games here at one point to get floats over to Python but we could probably just be explicit on the Python side especially now that Inline::Python is gone.

Copy link
Member

@taldcroft taldcroft left a comment

Choose a reason for hiding this comment

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

But thinking some more, the existing warning that there is a > 5 degree difference should give enough warning to the reviewer and we will know to treat the SMALLER case as critical. So I'm approving now with the existing testing.

@jeanconn
Copy link
Contributor Author

Right now, this PR uses the angle-from-nmm-time for acq probability if more than 5 degrees different from maneuver angle and prints it in the maneuver info above the catalog but there's no warning. Sounds like there needs to be a warning of some kind if angle-from-nmm-time is smaller than maneuver angle. And it sounds like in that case the acq probability should be calculated with the larger angle.

@taldcroft
Copy link
Member

I was hoping to avoid another revision that you're right.

@jeanconn
Copy link
Contributor Author

I'm taking your "that" as a "but" in the previous comment and I put in some tiny changes to add a critical warning for the unexpected case and to change the "use the angle-from-nmm" code to only use that angle for probabilities if more than 5 degrees greater.

Copy link
Member

@taldcroft taldcroft left a comment

Choose a reason for hiding this comment

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

The latest changes look good.

@jeanconn
Copy link
Contributor Author

Great! I note I redid the unit and functional tests at 47a15af .

@jeanconn jeanconn merged commit 20b7c0a into master Dec 28, 2023
@javierggt javierggt mentioned this pull request Jan 11, 2024
@javierggt javierggt mentioned this pull request Feb 6, 2024
@jeanconn jeanconn deleted the add-up-nmm branch September 25, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add time in minutes to ir zone report
2 participants