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

Use dyn_bgd_n_faint = 2 #412

Merged
merged 18 commits into from
Jul 11, 2023
Merged

Use dyn_bgd_n_faint = 2 #412

merged 18 commits into from
Jul 11, 2023

Conversation

jeanconn
Copy link
Contributor

@jeanconn jeanconn commented Jun 16, 2023

Description

Update starcheck to apply dyn_bgd_n_faint bonus = 2 to guide_count and imposter checking.

Interface impacts

None.

Testing

Tested with ska3-matlab-2023.4rc6 on fido. This PR requires sparkles 4.22.1 .

Unit tests

Functional tests

Ran a set of weeks and tested the cmdline option with output from this script at
https://icxc.cfa.harvard.edu/aspect/test_review_outputs/starcheck-pr412

jeanconn-fido> more run.sh
# Long week and IR Zone holds
/home/jeanconn/git/starcheck/sandbox_starcheck -dir /data/mpcrit1/mplogs/2022/DEC2622/oflsa -out dec2622a_test
/proj/sot/ska3/flight/bin/starcheck -dir /data/mpcrit1/mplogs/2022/DEC2622/oflsa -out dec2622a_flight
/proj/sot/ska/bin/diff2html dec2622a_flight.txt dec2622a_test.txt > dec2622a_diff.html

# Monitor star
/home/jeanconn/git/starcheck/sandbox_starcheck -dir /data/mpcrit1/mplogs/2022/NOV2822/oflsa -out nov2822a_test
/proj/sot/ska3/flight/bin/starcheck -dir /data/mpcrit1/mplogs/2022/NOV2822/oflsa -out nov2822a_flight
/proj/sot/ska/bin/diff2html nov2822a_flight.txt nov2822a_test.txt > nov2822a_diff.html

# Maneuver only loads
/home/jeanconn/git/starcheck/sandbox_starcheck -dir /data/mpcrit1/mplogs/2022/OCT2422/oflsb -out oct2422b_test
/proj/sot/ska3/flight/bin/starcheck -dir /data/mpcrit1/mplogs/2022/OCT2422/oflsb -out oct2422b_flight
/proj/sot/ska/bin/diff2html oct2422b_flight.txt oct2422b_test.txt > oct2422b_diff.html

# Replan
/home/jeanconn/git/starcheck/sandbox_starcheck -dir /data/mpcrit1/mplogs/2021/MAY0521/oflsa -out may0521a_test
/proj/sot/ska3/flight/bin/starcheck -dir /data/mpcrit1/mplogs/2021/MAY0521/oflsa -out may0521a_flight
/proj/sot/ska/bin/diff2html may0521a_flight.txt may0521a_test.txt > may0521a_diff.html

# JUN1923 week Needs dynamic bonus
/home/jeanconn/git/starcheck/sandbox_starcheck -dir /data/mpcrit1/mplogs/2023/JUN1923/oflsa -out jun1923a_test
/proj/sot/ska3/flight/bin/starcheck -dir /data/mpcrit1/mplogs/2023/JUN1923/oflsa -out jun1923a_flight
/proj/sot/ska/bin/diff2html jun1923a_flight.txt jun1923a_test.txt > jun1923a_diff.html

# JUN0523 week Needs dynamic bonus
/home/jeanconn/git/starcheck/sandbox_starcheck -dir /data/mpcrit1/mplogs/2023/JUN0523/oflsa -out jun0523a_test
/proj/sot/ska3/flight/bin/starcheck -dir /data/mpcrit1/mplogs/2023/JUN0523/oflsa -out jun0523a_flight
/proj/sot/ska/bin/diff2html jun0523a_flight.txt jun0523a_test.txt > jun0523a_diff.html

@jeanconn
Copy link
Contributor Author

@taldcroft I was thinking about updating this WIP to set dyn_bgd_n_faint to 2 by default but include a starcheck cmdline option (mostly if we needed to run with dyn_bgd_n_faint = 0 for transition weeks or regression).

What are your thoughts? I think we don't need to take the dyn_bgd_n_faint value from the pickle, though if we did we'd then want to check it against 2 anyway and make sure that dyn_bgd_n_faint wasn't set to an unexpected value of != 2.

What were you thinking on this topic?

@jeanconn jeanconn changed the title WIP: One possible quick implementation of bonus Add dyn_bgd_n_faint (default=2) to starcheck review Jun 27, 2023
@jeanconn jeanconn requested a review from taldcroft June 27, 2023 17:24
@jeanconn jeanconn changed the title Add dyn_bgd_n_faint (default=2) to starcheck review Add dyn_bgd_n_faint (default=2) to starcheck guide_count Jun 29, 2023
@taldcroft
Copy link
Member

This is a good example of where our infrastructure does not handle changing configurations very well. We need some data source to tell starcheck what is the expected value of dyn_bgd_n_faint and dyn_bgd_dt_ccd at a particular time. chandra_models is an obvious candidate.

Overall I don't think that dyn_bgd_n_faint should be singled out for a new command line option over the many other review criteria that are hardwired. The current situation is that for obsids after the patch uplink the review should be done using 2, -4.0 respectively since those are the flight-approved values of those constants (approved by SSAWG) that reflect the spacecraft capabilities. For the time being I'd prefer setting those constants based on the observation date being before or after the patch uplink date.

I agree with the concept of exporting values like dyn_bgd_n_faint, but not to the top of the starcheck output. It should go to a machine-readable JSON along with all of the other header info. That's a different PR, so for now I'd just remove that new line of starcheck header. (Again, I don't see dyn_bgd_n_faint being conceptually different from the T_ccd limit or any other review critieria. It is just the parameter du jour).

@jeanconn
Copy link
Contributor Author

jeanconn commented Jul 4, 2023

I just figured a cmdline option was the easiest way to let me see "what would this be without the bonus" which I thought could have value for load review to me and testing during the transition. (Well.. and I thought it was likely that an override to dyn_bgd_n_faint = 3 might be useful).

@jeanconn jeanconn changed the title Add dyn_bgd_n_faint (default=2) to starcheck guide_count Add dyn_bgd_n_faint (default=2) to starcheck review Jul 4, 2023
@jeanconn jeanconn changed the title Add dyn_bgd_n_faint (default=2) to starcheck review Use dyn_bgd_n_faint = 2 Jul 4, 2023
@jeanconn
Copy link
Contributor Author

jeanconn commented Jul 4, 2023

Updated to use local date-based selection.

@taldcroft
Copy link
Member

"what would this be without the bonus"

I'm not sure why we need to answer that question going forward. The program has agreed that mission loads shall be planned using the bonus when dyn bgd is enabled and it is extremely unlikely that we'll ever plan observations using the legacy background.

In the event that we do need to answer that question, it can be done easily enough with a local dev version with changed constants.

starcheck/utils.py Outdated Show resolved Hide resolved
starcheck/utils.py Outdated Show resolved Hide resolved
starcheck/utils.py Outdated Show resolved Hide resolved
starcheck/utils.py Outdated Show resolved Hide resolved
starcheck/src/lib/Ska/Starcheck/Obsid.pm Show resolved Hide resolved
@jeanconn
Copy link
Contributor Author

jeanconn commented Jul 6, 2023

And while I'd rerun the testing with the latest updates, I'd forgotten to update the description to indicate that the cmdline option is gone and the starcheck text output is gone. Done.

@jeanconn jeanconn requested a review from taldcroft July 10, 2023 13:07
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.

Finished review. There is only one substantive comment that might require re-running tests, but if so then you might as well address the code nitpicks.

starcheck/src/lib/Ska/Starcheck/Obsid.pm Show resolved Hide resolved
# Pass 1 to _guide_count as third arg to use the count_9th mode
my $bright_count = sprintf("%.1f",
call_python("utils._guide_count", [ \@mags, $self->{ccd_temp}, 1 ]));
# Pass 1 to _guide_count as fourth arg to use the count_9th mode
Copy link
Member

Choose a reason for hiding this comment

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

This comment is no longer accurate but can be removed now with the kwargs explicitly called out.

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 updated the comment.

starcheck/utils.py Outdated Show resolved Hide resolved
starcheck/utils.py Outdated Show resolved Hide resolved
starcheck/utils.py Outdated Show resolved Hide resolved
starcheck/utils.py Outdated Show resolved Hide resolved
starcheck/utils.py Show resolved Hide resolved
@taldcroft
Copy link
Member

@jeanconn - looks good. Is there any way in the functional testing to validate the new code which applies the bonus temperatures to the dark cal? From what I can see the code looks reasonable but still. I see you put the t_ccd into a diagnostic dict, so is that exposed somewhere to view?

@jeanconn
Copy link
Contributor Author

Good point on the functional testing. I think I just did some print statements when I was adding the code - I will look to see if it makes sense to grab t_ccd from that diagnostic dict or just print out some stuff for this PR.

@jeanconn
Copy link
Contributor Author

I think I still need @taldcroft to either agree this is done or decide that #418 is reasonable and should also be merged.

@jeanconn
Copy link
Contributor Author

Incremental updates to the testing outputs in the description are non-trivial across an agasc supplement update weekend, so I've set the outputs to be remade and will rereview.

jeanconn and others added 4 commits July 11, 2023 07:46
Co-authored-by: Tom Aldcroft <taldcroft@gmail.com>
Co-authored-by: Tom Aldcroft <taldcroft@gmail.com>
Co-authored-by: Tom Aldcroft <taldcroft@gmail.com>
Co-authored-by: Tom Aldcroft <taldcroft@gmail.com>
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 great!

@jeanconn
Copy link
Contributor Author

👍 And I confirm I've re-reviewed the diff outputs and see only the expected changes from dynamic bonus.

jeanconn added 2 commits July 11, 2023 11:03
Add a unit test for dyn bgd hotpix imposter calc
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.

2 participants