diff --git a/starcheck/src/lib/Ska/Starcheck/Obsid.pm b/starcheck/src/lib/Ska/Starcheck/Obsid.pm index ec8fb0b2..357d3567 100644 --- a/starcheck/src/lib/Ska/Starcheck/Obsid.pm +++ b/starcheck/src/lib/Ska/Starcheck/Obsid.pm @@ -581,6 +581,19 @@ sub set_star_catalog { } } +############################################################################################# +sub get_creep_status{ +############################################################################################# + my $self = shift; + my $targ_cmd = find_command($self, "MP_TARGQUAT", -1); + my $man_angle_next_data = call_python("state_checks.get_obs_man_angle_next", + [ $targ_cmd->{tstop}, $self->{backstop} ]); + # Round the angle_next to 1 decimal place + my $angle_next = sprintf("%.1f", $man_angle_next_data->{"angle"}); + my $creep_away = ($angle_next < 3.0); + return $creep_away; +} + ############################################################################################# sub check_dither { ############################################################################################# @@ -697,20 +710,13 @@ sub check_dither { } } - my $targ_cmd = find_command($self, "MP_TARGQUAT", -1); - my $man_angle_next_data = call_python("state_checks.get_obs_man_angle_next", - [ $targ_cmd->{tstop}, $self->{backstop} ]); - # Add a check that for small or zero dither amplitudes, that creep-away is used. # The idea is that dynamic background is less effective for small or zero dither # and such observations could end in larger roll errors. Check added in PR #452. # Operationally, we also do not expect to use, for example, 4x4 dither, so this # adds a CAUTION for unexpected small dither patterns. - - # Round the angle_next to 1 decimal place - my $angle_next = sprintf("%.1f", $man_angle_next_data->{"angle"}); - my $creep_away = ($angle_next < 3.0); + my $creep_away = $self->get_creep_status(); my $no_dither = (($guide_dither->{state} eq 'DISA') or (($guide_dither->{ampl_y_int} == 0) and ($guide_dither->{ampl_p_int}== 0))); my $small_dither = (($guide_dither->{ampl_y_int} < 8) and ($guide_dither->{ampl_p_int} < 8) @@ -2905,14 +2911,23 @@ sub check_guide_count { "Dither disabled or 0 - dynamic background bonus disabled for guide count.\n"; } + my $creep_away = $self->get_creep_status(); + my $guide_count = $self->count_guide_stars($dyn_bgd); - my $min_num_gui = ($self->{obsid} >= 38000) ? 6.0 : 4.0; + # If obsid >= 38000, min guide count is 6.0 + # If an OR, the required number is 3.5 if creep away else 4.0 + my $min_num_gui = ($self->{obsid} >= 38000) ? 6.0 : ($creep_away ? 3.5 : 4.0); if ($guide_count < $min_num_gui) { push @{ $self->{warn} }, "Guide count of $guide_count < $min_num_gui.\n"; } + if (($self->{obsid} < 38000) && ($creep_away) && ($guide_count < 4.0) && ($guide_count >= 3.5)) { + push @{ $self->{yellow_warn} }, + "Guide count of $guide_count < 4.0 but uses creep-away\n"; + } + # Also save the guide count in the figure_of_merit $self->{figure_of_merit}->{guide_count} = $guide_count; } diff --git a/starcheck/src/starcheck.pl b/starcheck/src/starcheck.pl index b90e0cb6..ec96d609 100755 --- a/starcheck/src/starcheck.pl +++ b/starcheck/src/starcheck.pl @@ -820,8 +820,10 @@ sub json_obsids { if (defined $cat) { my $guide_count = $obs{$obsid}->{figure_of_merit}->{guide_count}; - # minumum requirements for fractional guide star count for ERs and ORs - my $min_num_gui = ($obs{$obsid}->{obsid} >= 38000) ? 6.0 : 4.0; + my $creep_away = $obs{$obsid}->get_creep_status(); + + # minimum requirements for fractional guide star count for ERs and ORs + my $min_num_gui = ($obs{$obsid}->{obsid} >= 38000) ? 6.0 : ($creep_away ? 3.5 : 4.0); # Use the acq prob model values saved in figure_of_merit for the expected # number of acq stars and a bad overall probability. figure_of_merit isn't