-
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
Implement acquisition box overlap penalty #394
Conversation
I note that #393 wasn't really working yet because my penalty was crap. Much improved in your code. I've run into the issue with this PR code that optimization doesn't always seem to succeed in avoiding the overlap with the smaller penalty. So a question about defining what is sufficient and if we want to nudge toward not overlapping based on the penalty determined from your analysis or just prohibit overlap. This one looks to get me overlap in this PR code for example.
|
I note in passing that it looks like the P2 if you exclude the overlapping star
looks correct and higher but optimization doesn't seem to arrive at that solution? |
Thanks, interesting examples. Though I wonder if you have any examples that don't require excluding a star (which never really happens in flight scheduling) to show a problem. This PR is also an exploration to see if a smaller-footprint strategy can work and maybe it won't. The optimization currently tries to replace the worst p_acq star with a new one after optimizing half-widths. For 29044 it is not possible to shrink the boxes enough to get rid of the overlap. |
"Though I wonder if you have any examples that don't require excluding a star (which never really happens in flight scheduling) to show a problem." Right -- I was using excluding a star as a way to "apply pressure" to the catalog that I already knew had overlap but haven't made an overlap data set (or used yours from the exploration notebook) for testing. I also figured that with this PR strategy that optimization tries box sizes and maybe some other stars but doesn't check the case of don't-use-this-star-at-all, which might be what you actually want in some cases. |
Reviewing with the updated code, it looks to me like only two obsids in the last 6 years (>2018:001), obsids 25281 and 27476 end up with overlap in the optimized boxes (with a larger than 0.2 mag sep), and since you've set the code to update p_acq, once can see the reduced p_acq due to overlap in the final catalog. That looks great to me. |
I'm slightly concerned about performance since this makes star selection 25% slower. There might be some optimization that can reduce this. |
One question I didn't ask of this data set was how often this gives allowed-to-overlap boxes within the 0.2 mag sep deadband. One performance optimization I suppose would be to just not allow overlaps in the box-size-optimization by short-circuiting that instead of going through the full updated-p-acq-and-p-safe calculations. |
@jeanconn - After the recent commits I think the performance is fine now, it's less than a 5% increase. Do you have ideas for other unit or functional tests? |
I'm planning to make a ruff PR from master and hopefully rebase this on that. All the lint problems here are silly. |
Great performance ideas and implementation! (Haven't reviewed in detail yet). |
27ff09b
to
1187ffd
Compare
Regarding validation and the impact on selection, I assume that https://github.com/sot/proseco/blob/fbf13c0318e237b776c0e6a795aecd809d75a7f7/validate/pr394-overlap-penalty-selection.ipynb is calculating final P2 without the penalty for the "no penalty" part. Not sure if it is worth the effort, but to me, at some level I'm not interested in P2 without the penalty calculated, I'm interested with and without the penalty applied in selection. |
@jeanconn - this was a point of confusion for me at first, but I believe the results are what you want. The environment variable override is only for star selection via the call to |
I don't immediately see how calc_p_safe could be using the penalties for P2 when the penalty looks to only be calculated if the env var is not set to true (in get_overlap_penalties) and the boxes are defined as always having zero overlap if the var is set to true. I was thinking that it would make sense just to add that in the notebook by redetermining overlaps for the "penalty not used in selection" cases or by force-including all the stars and boxes as determined by that star selection. |
@jeanconn - see the latest version of the selection validation notebook. I'm hoping this will make sense to you. |
And yeah, that helps. The labeling is still challenging, if "p2_no_penalty" is p2 with the penalty included but of the penalty-not-used-in-selection catalog. |
I updated the notebook to add clarification on the values and interpretations of the plots. Thanks for the feedback, this would probably have been confusing to SSAWG and I'm glad to have thought it through. |
if box_overlap(yang1, zang1, halfw1, yang2, zang2, halfw2): | ||
if mag1 + OVERLAP_MAG_DEADBAND < mag2: | ||
# Star 1 is at least 0.2 mag brighter than star 2 | ||
penalties[idx1] = OVERLAP_P_ACQ_PENALTY |
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 note that from inspection and a quick functional test, it looks like there's no code here to increase the penalty on more than one overlap (because the penalty is just set with =
not *=
, right?). I think that's completely fine but not sure if it is worth a comment.
These changes also include support of the new env var for testing, but I don't see that as an interface impact that needs to be advertised in the description, as it is not intended to be used outside of local-to-proseco testing. |
Description
This starts from #393 but reduces the scope slightly and does the implementation in a way that tries to factor out the changes to the extent possible.
The overlap penalty consists of multiplying the existing acquisition probability by 0.7 for search boxes that are within 20 arcsec of overlapping and where the penalized star is at least 0.2 mag brighter than the overlapping star. This is derived from statistics for the acquisition success of bright stars that have an overlapping search box with a fainter star. The value of 0.7 is the worst case.
Review
This was reviewed and approved by SS&AWG on 2024-Mar-13.
Interface impacts
No API changes but it will change which stars are selected in cases where an overlapping box would have been chosen.
Testing
Unit tests
Independent check of unit tests by Jean
Functional tests
See the validation notebooks included in this PR.