Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions starcheck/src/lib/Ska/Starcheck/Obsid.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
#############################################################################################
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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} },
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This could be an "info" statement instead of "yellow_warn" but I figured this is rare enough to rise to the "just a bit more attention" the yellow warn gives.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sounds good.

"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;
}
Expand Down
6 changes: 4 additions & 2 deletions starcheck/src/starcheck.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down