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

round guide count and P2 #378

Merged
merged 8 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from 7 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
32 changes: 26 additions & 6 deletions starcheck/src/lib/Ska/Starcheck/Obsid.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1115,11 +1115,12 @@ sub check_bright_perigee{
}

# Pass 1 to _guide_count as third arg to use the count_9th mode
my $bright_count = _guide_count(\@mags, $self->{ccd_temp}, 1);
my $bright_count = sprintf("%.1f", _guide_count(\@mags, $self->{ccd_temp}, 1));
if ($bright_count < $min_n_stars){
push @{$self->{warn}}, "$bright_count star(s) brighter than scaled 9th mag. "
. "Perigee requires at least $min_n_stars\n";
}
$self->{figure_of_merit}->{guide_count_9th} = $bright_count;
}


Expand Down Expand Up @@ -2269,11 +2270,15 @@ sub print_report {
my $bad_FOM = $self->{figure_of_merit}->{cum_prob_bad};
$o .= "$red_font_start" if $bad_FOM;
$o .= "Probability of acquiring 2 or fewer stars (10^-x):\t";
$o .= substr(sprintf("%.4f", $self->{figure_of_merit}->{P2}), 0, 6) . "\t";
$o .= sprintf("%.1f", $self->{figure_of_merit}->{P2}) . "\t";
$o .= "$font_stop" if $bad_FOM;
$o .= "\n";
$o .= sprintf("Acquisition Stars Expected : %.2f\n",
$self->{figure_of_merit}->{expected});
$o .= sprintf("Acquisition Stars Expected : %.2f\n", $self->{figure_of_merit}->{expected});
$o .= sprintf("Guide star count: %.1f \t", $self->{figure_of_merit}->{guide_count});
if (defined $self->{figure_of_merit}->{guide_count_9th}){
$o .= sprintf("Guide count_9th: %.1f", $self->{figure_of_merit}->{guide_count_9th});
}
$o .= "\n";
}


Expand Down Expand Up @@ -2452,7 +2457,7 @@ sub identify_stars {
my $gs_mag = $c->{"GS_MAG$i"};
my $dmag = abs($star->{mag_aca} - $gs_mag);
if ($dmag > 0.01){
push @{$self->{warn}},
push @{$self->{yellow_warn}},
sprintf("[%d] Guide sum mag diff from agasc mag %9.5f\n", $i, $dmag);
}
# let's still confirm that the backstop yag zag is what we expect
Expand Down Expand Up @@ -2619,6 +2624,19 @@ sub quat2radecroll {
return ($ra, $dec, $roll);
}

###################################################################################
sub check_guide_count{
###################################################################################
my $self = shift;
my $guide_count = $self->count_guide_stars();

if ($guide_count < 4.0){
push @{$self->{warn}}, "Guide count of $guide_count < 4.0.";
}

# Also save the guide count in the figure_of_merit
$self->{figure_of_merit}->{guide_count} = $guide_count;
taldcroft marked this conversation as resolved.
Show resolved Hide resolved
}

###################################################################################
sub count_guide_stars{
Expand All @@ -2634,7 +2652,7 @@ sub count_guide_stars{
push @mags, $mag;
}
}
return _guide_count(\@mags, $self->{ccd_temp});
return sprintf("%.1f", _guide_count(\@mags, $self->{ccd_temp}));
}


Expand Down Expand Up @@ -2850,6 +2868,8 @@ sub set_proseco_probs_and_check_P2{
}
my ($p_acqs, $P2, $expected) = proseco_probs($args);

$P2 = sprintf("%.1f", $P2);

my @acq_indexes = @{$args->{acq_indexes}};

# Assign those p_acqs to a slot hash and the catalog P_ACQ by index
Expand Down
3 changes: 2 additions & 1 deletion starcheck/src/starcheck.pl
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ sub json_obsids{
$obs{$obsid}->check_sim_position(@sim_trans) unless $par{vehicle};
$obs{$obsid}->check_momentum_unload(\@bs);
$obs{$obsid}->check_bright_perigee($radmon);
$obs{$obsid}->check_guide_count();

# Make sure there is only one star catalog per obsid
warning ("More than one star catalog assigned to Obsid $obsid\n")
Expand Down Expand Up @@ -674,7 +675,7 @@ sub json_obsids{
$out .= sprintf "<A HREF=\"#obsid$obs{$obsid}->{obsid}\">OBSID = %5s</A>", $obs{$obsid}->{obsid};
$out .= sprintf " at $obs{$obsid}->{date} ";

my $guide_count = $obs{$obsid}->count_guide_stars();
my $guide_count = $obs{$obsid}->{figure_of_merit}->{guide_count};
taldcroft marked this conversation as resolved.
Show resolved Hide resolved

# if Obsid is numeric, print tally info
if ($obs{$obsid}->{obsid} =~ /^\d+$/ ){
Expand Down