Skip to content

Commit

Permalink
Make a consistent P2_yellow which is P2_red + 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
taldcroft committed Jan 17, 2019
1 parent 945fa19 commit 4e289bf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
32 changes: 21 additions & 11 deletions starcheck/src/lib/Ska/Starcheck/Obsid.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2823,7 +2823,7 @@ sub proseco_args{


###################################################################################
sub set_proseco_probs{
sub set_proseco_probs_and_check_P2{
###################################################################################
# For observations with a star catalog and which have valid parameters already determined
# in $self->{proseco_args}, call the Python proseco_probs method to calculate the
Expand Down Expand Up @@ -2851,18 +2851,28 @@ sub set_proseco_probs{
}
$self->{acq_probs} = \%slot_probs;

# Set the P2 requirement to be 2.0 for ORs and 3.0 for ERs.
my $P2_required = $self->{obsid} < $ER_MIN_OBSID ? 2.0 : 3.0;
# Red and yellow warnings on acquisition safing probability.

# Set the P2 requirement to be 2.0 for ORs and 3.0 for ERs. The higher limit for ER
# reflects a desire to minimize integrated mission risk for observations where the
# attitude can be selected freely. Yellow warning for marginal catalog is set to a
# factor of 10 less risk than the red limit P2 probability for OR / ER respectively).
my $P2_red = $self->{obsid} < $ER_MIN_OBSID ? 2.0 : 3.0;
my $P2_yellow = $P2_red + 1.0;

# Create a structure that gets used for report generation only.
$self->{figure_of_merit} = {expected => substr($expected, 0, 4),
P2 => $P2,
cum_prob_bad => ($P2 < $P2_required)};
if ($P2 < $P2_required){
push @{$self->{warn}}, ">> WARNING: -log10 probability of 2 or fewer stars < $P2_required\n";
}
# If OR and P2 less than 3.0, yellow_warn. This probably doesn't need the check on OR/ER
# because if it is an ER and < 3.0 the if statement above was hit.
elsif (($self->{obsid} < $ER_MIN_OBSID) and ($P2 < 3.0)){
push @{$self->{yellow_warn}}, ">> WARNING: -log10 probability of 2 or fewer stars < 3.0\n";
cum_prob_bad => ($P2 < $P2_red)};

# Do the actual checks
if ($P2 < $P2_red){
push @{$self->{warn}},
">> WARNING: -log10 probability of 2 or fewer stars < $P2_red\n";
}
elsif ($P2 < $P2_yellow){
push @{$self->{yellow_warn}},
">> WARNING: -log10 probability of 2 or fewer stars < $P2_yellow\n";
}

}
Expand Down
2 changes: 1 addition & 1 deletion starcheck/src/starcheck.pl
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ sub json_obsids{
$obs{$obsid}->check_dither($dither);
# Get the args that proseco would want
$obs{$obsid}->{'proseco_args'} = $obs{$obsid}->proseco_args();
$obs{$obsid}->set_proseco_probs();
$obs{$obsid}->set_proseco_probs_and_check_P2();
$obs{$obsid}->check_star_catalog($or{$obsid}, $par{vehicle});
$obs{$obsid}->check_sim_position(@sim_trans) unless $par{vehicle};
$obs{$obsid}->check_momentum_unload(\@bs);
Expand Down

0 comments on commit 4e289bf

Please sign in to comment.