Skip to content

Commit

Permalink
Remove maneuver error (#436)
Browse files Browse the repository at this point in the history
* Remove use of maneuver error file 
* Update ACA checklist for no maneuver error file
  • Loading branch information
jeanconn authored Feb 15, 2024
1 parent fa55e5a commit 8393b06
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 135 deletions.
5 changes: 2 additions & 3 deletions starcheck/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,12 @@ def get_manvrs(obs_text):
target_Q3=float(quat_re.group(3)),
target_Q4=float(quat_re.group(4))))
angle_re = re.match(
"\s+MANVR: Angle=\s+(\d+\.\d+)\sdeg\s+Duration=\s+(\d+)\ssec\s+Slew\serr=\s+(\d+\.\d)\sarcsec(\s+End=\s+(\S+))?",
"\s+MANVR: Angle=\s+(\d+\.\d+)\sdeg\s+Duration=\s+(\d+)\ssec(\s+Slew\serr=\s+(\d+\.\d)\sarcsec)?(\s+End=\s+(\S+))?",
mline)
if angle_re:
curr_manvr.update(dict(angle_deg=float(angle_re.group(1)),
duration_sec=int(angle_re.group(2)),
slew_err_arcsec=float(angle_re.group(3)),
end_date=angle_re.group(5)))
end_date=angle_re.groups()[-1]))
if 'target_Q1' not in curr_manvr:
raise ValueError("No Q1,Q2,Q3,Q4 line found when parsing starcheck.txt")
# If there is a real manvr, append to list
Expand Down
11 changes: 4 additions & 7 deletions starcheck/src/aca_load_review_cl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ ACA Load Review Checklist
file in the starcheck git project
Date: 2022-Oct-26
Date: 2024-Jan-17

Version: 3.9
Version: 3.10

Author: E. Martin, S. Hurley, T. Aldcroft, J. Connelly, J. Gonzalez

Expand Down Expand Up @@ -53,8 +53,6 @@ Load Input Files

- Radmon: ./History/RADMON.txt

- Maneuver Error: ./output/MMMddyyv_ManErr.txt

- Processing Summ: ./mps/msddd:hhvv.sum

- Timeline Report:
Expand Down Expand Up @@ -236,9 +234,8 @@ Checks
|ACA-021|ACA field-of-view |X|X|FL: Z at least half-width inside |n/a |Reduced aspect |
| |limits | | |field-of-view limits | |quality |
+-------+------------------+-+-+-------------------------------------------+----+----------------+
| | |X|X|AS: spoiled by another object brighter than| |Possible Bright |
|ACA-022|Spoiler stars | | |mag(AS) + 0.2, that lies closer than |n/a |Star Hold |
| | | | |maneuver uncertainty to the AS search box | | |
|ACA-022|Spoiler stars |X|X|AS: Impact of acquisition spoilers included|n/a |Possible Bright |
| | | | |in acquisition probability calculation | |Star Hold |
+-------+------------------+-+-+-------------------------------------------+----+----------------+
| | |X|X|GS: spoiled by another object brighter than| |Reduced aspect |
|ACA-023|Spoiler stars | | |mag(GS) + 0.2, that lies closer than |n/a |quality |
Expand Down
49 changes: 0 additions & 49 deletions starcheck/src/lib/Ska/Parse_CM_File.pm
Original file line number Diff line number Diff line change
Expand Up @@ -409,55 +409,6 @@ sub get_fid_actions {
return (\@action, \@time, $fid_time_violation);
}

#AXMAN Run at 03/25/2002 08:57:09 Version of Mar-12-2002
#
#Man File = C:\wsdavis\CXOFiles\MPS_Sched_Chk\APR0102A\md091_0405.dot.man
#Calib File 1 = C:\wsdavis\CXOFiles\ManError\GYRO_OAC.mat
#Calib File 2 = C:\wsdavis\CXOFiles\ManError\GYROTotalCal.mat
#SBoxMargin = 20.00 asec, 3-sig init roll uncer = 30.00 asec
# obsid MaxErrYZ Seg start_time stop_time ssss angle X-axis Y-axis Z-axis initQ1 initQ2 initQ3 initQ4 finalQ1 finalQ2 finalQ3 finalQ4 iru-X iru-Y iru-Z aber-X aber-Y aber-Z del-Y del-Z delYZ iruadjYZ totadjYZ syserr.Y syserr.Z ranerr.Y ranerr.Z
# 2193 59.43 0 2002:091:04:50:16 2002:091:05:09:04 ---- 35.531 -0.425054 -0.486987 0.763003 0.85686666 -0.10606580 -0.34000709 0.37272612 0.69244839 -0.31178304 -0.37809776 0.52947960 -21.34 8.07 20.98 4.11 5.37 -8.15 0.00 0.00 0.00 22.48 29.25 2.70 29.13 12.15 10.31
# 1664 87.62 0 2002:091:10:59:56 2002:091:11:27:23 ---- 74.053 0.113094 -0.877861 0.465370 0.69244839 -0.31178304 -0.37809776 0.52947960 0.30163013 -0.74861636 -0.49829514 0.31669350 -30.97 23.87 28.00 5.67 16.14 -15.44 0.00 -0.00 0.00 36.79 44.12 7.73 43.44 15.59 24.18
#total number of maneuvers = 27
#---- 5
#---+ 1
###############################################################
sub man_err {
###############################################################
my $man_err = shift;
my $in_man = 0;
my @me = ();
my @cols;
open(my $MANERR, $man_err)
or die "Couldn't open maneuver error file $man_err for reading\n";
while (<$MANERR>) {
chomp;
last if (/total number/i);
next unless (/\S/);
next if (/#Schedule generated/);
if ($in_man) {
my @vals = split;
if ($#vals != $#cols) {
warn "man_err: ERROR - mismatch between column names and data values\n";
return (); # return nothing
}
my %data = map { $cols[$_], $vals[$_] } (0 .. $#cols);
$data{Seg} = 1
if ($data{Seg} == 0)
; # Make it easier later on to match the segment number
# with the MP_TARGQUAT commands
$data{obsid} = sprintf "%d", $data{obsid}; # Clip leading zeros

push @me, \%data;
}
if (/^\s*obsid\s+maxerryz\s+seg/i) {
@cols = split;
$in_man = 1;
}
}
close $MANERR;
return @me;
}

###############################################################
sub backstop {
Expand Down
69 changes: 2 additions & 67 deletions starcheck/src/lib/Ska/Starcheck/Obsid.pm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ use Carp;

my $VERSION = '$Id$'; # '
my $ER_MIN_OBSID = 38000;
my $ACA_MANERR_PAD = 20; # Maneuver error pad for ACA effects (arcsec)
my $r2a = 3600. * 180. / 3.14159265;
my $faint_plot_mag = 11.0;
my %Default_SIM_Z = (
Expand Down Expand Up @@ -409,44 +408,6 @@ sub set_maneuver {
}
}

##################################################################################
sub set_manerr {
#
# Set the maneuver error for each MP_TARGQUAT command within the obsid
# using the more accurate values from Bill Davis' code
#
##################################################################################
my $self = shift;
my @manerr = @_;
my $n = 1;
my $c;
while ($c = find_command($self, "MP_TARGQUAT", $n)) {

foreach my $me (@manerr) {

# There should be a one-to-one mapping between maneuver segments in the maneuver
# error file and those in the obsid records. First, find what *should* be the
# match. Then check quaternions to make sure

if ($self->{obsid} eq $me->{obsid} && $n == $me->{Seg}) {
if ( abs($me->{finalQ1} - $c->{Q1}) < 1e-7
&& abs($me->{finalQ2} - $c->{Q2}) < 1e-7
&& abs($me->{finalQ3} - $c->{Q3}) < 1e-7)
{
$c->{man_err} = $me->{MaxErrYZ} + $ACA_MANERR_PAD;
$c->{man_err_data} = $me; # Save the whole record just in case
}
else {
push @{ $self->{yellow_warn} },
sprintf(
"Mismatch in target quaternion ($c->{date}) and maneuver error file\n"
);
}
}
}
$n++;
}
}

##################################################################################
sub set_ps_times {
Expand Down Expand Up @@ -1114,17 +1075,6 @@ sub check_star_catalog {
my $oflsid = $self->{dot_obsid};
my $obsid = $self->{obsid};

# Set slew error (arcsec) for this obsid, or 120 if not available
my $slew_err;
my $targquat;
if ($targquat = find_command($self, "MP_TARGQUAT", -1)) {
$slew_err = $targquat->{man_err};
}
else {
# if no target quaternion, warn and continue
push @{ $self->{warn} }, "No target/maneuver for obsid $obsid ($oflsid). \n";
}
$slew_err = 120 if not defined $slew_err;

# ACA-004
# if no starcat, warn and quit this subroutine
Expand Down Expand Up @@ -1292,8 +1242,6 @@ sub check_star_catalog {
my $halfw = $c->{"HALFW$i"};
my $db_stats = $c->{"GS_USEDBEFORE${i}"};

# Search error for ACQ is the slew error, for fid, guide or mon it is about 4 arcsec
my $search_err = ((defined $type) and ($type =~ /BOT|ACQ/)) ? $slew_err : 4.0;

# Find position extrema for smallest rectangle check
if ($type =~ /BOT|GUI/) {
Expand Down Expand Up @@ -1663,19 +1611,6 @@ sub check_star_catalog {
else { push @yellow_warn, $warn }
}

# Search box spoiler - star within search box + search error and within 1.0 mags ACA-023
if ( $type =~ /BOT|ACQ/
and $dz < $halfw + $search_err
and $dy < $halfw + $search_err
and $dm > -1.0)
{
my $warn =
sprintf("[%2d] Search spoiler. %10d: "
. "Y,Z,Radial,Mag seps: %3d %3d %3d %4s\n",
$i, $star->{id}, $dy, $dz, $dr, $dm_string);
if ($dm > -0.2) { push @orange_warn, $warn }
else { push @yellow_warn, $warn }
}

# Common column: dz within limit, spoiler is $col_sep_mag brighter than star,
# and spoiler is located between star and readout ACA-026
Expand Down Expand Up @@ -2169,8 +2104,8 @@ sub print_report {
);
if (exists $c->{man_err} and exists $c->{dur} and exists $c->{angle}) {
$o .= sprintf(
" MANVR: Angle= %6.2f deg Duration= %.0f sec Slew err= %.1f arcsec End= %s\n",
$c->{angle}, $c->{dur}, $c->{man_err},
" MANVR: Angle= %6.2f deg Duration= %.0f sec End= %s\n",
$c->{angle}, $c->{dur},
substr(time2date($c->{tstop}), 0, 17));
}
if ( (defined $c->{man_angle_calc})
Expand Down
9 changes: 0 additions & 9 deletions starcheck/src/starcheck.pl
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@

my $agasc_file = get_file("$par{agasc_file}", "agasc_file");

my $manerr_file = get_file("$par{dir}/output/*_ManErr.txt", 'manerr');
my $ps_file = get_file("$par{dir}/mps/ms*.sum", 'processing summary');
my $tlr_file = get_file("$par{dir}/${sosa_dir_slash}*.tlr", 'TLR', 'required');

Expand Down Expand Up @@ -335,13 +334,6 @@
my %odb = Ska::Parse_CM_File::odb($odb_file);
Ska::Starcheck::Obsid::set_odb(%odb);

# Read Maneuver error file containing more accurate maneuver errors
print "Reading Maneuver Error file $manerr_file\n";
my @manerr;
if ($manerr_file) {
@manerr = Ska::Parse_CM_File::man_err($manerr_file);
}
else { warning("Could not find Maneuver Error file in output/ directory\n") }

# Get an initial dither state from kadi. Dither states are then built from backstop commands
# after this time. If the running loads will be terminated in advance of new commands in the loads
Expand Down Expand Up @@ -454,7 +446,6 @@
$obs{$obsid}->set_target();
$obs{$obsid}->set_star_catalog();
$obs{$obsid}->set_maneuver($mm);
$obs{$obsid}->set_manerr(@manerr) if (@manerr);
$obs{$obsid}->set_files(
$STARCHECK,
$backstop,
Expand Down

0 comments on commit 8393b06

Please sign in to comment.