sot / starcheck

BSD 3-Clause "New" or "Revised" License
3 stars 0 forks source link

Remove maneuver error #436

Closed jeanconn closed 6 months ago

jeanconn commented 9 months ago

Description

Remove maneuver error file parsing and use in load review.

The acquisition star search spoiler check is also removed (though appears to be incorrectly labeled ACA-023 in starcheck). The warning based on one maneuver error estimate is no longer relevant with proseco's probability of acquisition based on a variety of factors including spoiler stars and imposters. This PR updates the checklist to indicate this.

Update starcheck_parser to handle starcheck.txt without maneuver error and stop archiving maneuver error in starcheck database.

Interface impacts

Newly "ingested" starcheck outputs into mica database will not have slew_err_arcsec populated.

This PR includes an update to the ACA checklist.

Testing

Unit tests

(ska3) flame:starcheck jean$ git rev-parse HEAD
1ed197514e886db2cbbd7a262e9808d93fdb6247
(ska3) flame:starcheck jean$ pytest
======================================================================= test session starts ========================================================================
platform darwin -- Python 3.10.8, pytest-7.2.1, pluggy-1.0.0
rootdir: /Users/jean/git/starcheck
plugins: timeout-2.1.0, anyio-3.6.2
collected 14 items                                                                                                                                                 

starcheck/tests/test_state_checks.py .............                                                                                                           [ 92%]
starcheck/tests/test_utils.py .                                                                                                                              [100%]

========================================================================= warnings summary =========================================================================
../../miniconda3/envs/ska3/lib/python3.10/site-packages/jupyter_client/connect.py:27
  /Users/jean/miniconda3/envs/ska3/lib/python3.10/site-packages/jupyter_client/connect.py:27: DeprecationWarning: Jupyter is migrating its paths to use standard platformdirs
  given by the platformdirs library.  To remove this warning and
  see the appropriate new directories, set the environment variable
  `JUPYTER_PLATFORM_DIRS=1` and then run `jupyter --paths`.
  The use of platformdirs will be the default in `jupyter_core` v6
    from jupyter_core.paths import jupyter_data_dir

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================== 14 passed, 1 warning in 5.34s

Independent check of unit tests by [REVIEWER NAME]

Functional tests

Several recent load weeks run. Output and diffs relative to master at https://icxc.cfa.harvard.edu/aspect/test_review_outputs/starcheck/starcheck-pr436/ . Diffs show expected changes:

  1. Warning about mismatch target quaternion removed.
  2. Acquisition spoiler warnings removed
  3. Output does not have slew error in text for every maneuver

I ran functional testing at 1ed1975 and did not rerun for the small additional change in c4e7caf, though I did do a quick run-test of sandbox_starcheck to confirm that c4e7caf did not introduce any format errors.

For functional testing of the starcheck parser, I confirmed that it reads old and new starcheck.txt files with no errors and does not include slew_err_arcsec.

Using the version of starcheck.parser in this PR
In [17]: test = starcheck.parser.read_starcheck('/proj/sot/ska/www/ASPECT_ICXC/test_review_outputs/starcheck/starcheck
    ...: -pr436/JAN1524b_test.txt')

In [18]: master = starcheck.parser.read_starcheck('/proj/sot/ska/www/ASPECT_ICXC/test_review_outputs/starcheck/starche
    ...: ck-pr436/JAN1524b_master.txt')

In [19]: test[0]['manvrs']
Out[19]: 
[{'mp_targquat_time': '2024:015:01:49:40.614',
  'mp_targquat_vcdu_cnt': 11256884,
  'target_Q1': -0.13912334,
  'target_Q2': -0.61804467,
  'target_Q3': -0.75670549,
  'target_Q4': 0.16143815,
  'angle_deg': 71.81,
  'duration_sec': 1617,
  'end_date': '2024:015:02:16:43',
  'instance': 0}]

In [20]: master[0]['manvrs']
Out[20]: 
[{'mp_targquat_time': '2024:015:01:49:40.614',
  'mp_targquat_vcdu_cnt': 11256884,
  'target_Q1': -0.13912334,
  'target_Q2': -0.61804467,
  'target_Q3': -0.75670549,
  'target_Q4': 0.16143815,
  'angle_deg': 71.81,
  'duration_sec': 1617,
  'end_date': '2024:015:02:16:43',
  'instance': 0}]

This compares with this behavior in master which just skips parsing the other maneuver details if there is no slew error recorded in the starcheck output

In [2]: test = starcheck.parser.read_starcheck('/proj/sot/ska/www/ASPECT_ICXC/test_review_outputs/starcheck/starcheck-
   ...: pr436/JAN1524b_test.txt')

In [4]: test[0]['manvrs'][0]
Out[4]: 
{'mp_targquat_time': '2024:015:01:49:40.614',
 'mp_targquat_vcdu_cnt': 11256884,
 'target_Q1': -0.13912334,
 'target_Q2': -0.61804467,
 'target_Q3': -0.75670549,
 'target_Q4': 0.16143815,
 'instance': 0}

In [5]: master = starcheck.parser.read_starcheck('/proj/sot/ska/www/ASPECT_ICXC/test_review_outputs/starcheck/starchec
   ...: k-pr436/JAN1524b_master.txt')

In [6]: master[0]['manvrs']
Out[6]: 
[{'mp_targquat_time': '2024:015:01:49:40.614',
  'mp_targquat_vcdu_cnt': 11256884,
  'target_Q1': -0.13912334,
  'target_Q2': -0.61804467,
  'target_Q3': -0.75670549,
  'target_Q4': 0.16143815,
  'angle_deg': 71.81,
  'duration_sec': 1617,
  'slew_err_arcsec': 46.9,
  'end_date': '2024:015:02:16:43',
  'instance': 0}]

It isn't a perfect test of the integration of this with the mica starcheck processing, but I also use a snapshot of the mica starcheck db and had it run it's update process with this PR starcheck.parser in PYTHONPATH. That confirms that inserting new rows into the maneuver table without slew_err_arcsec should not be a problem. From mica git repo ...

Spot checked an obsid

sqlite3 /proj/sot/.snapshot/weekly.2024-01-21_0015/ska/data/mica/archive/starcheck/starcheck.db3
sqlite> select obsid,slew_err_arcsec from starcheck_manvr where obsid = 29217;
29217|68.0
sqlite>

Ran update

ska3-jeanconn-fido> export PYTHONPATH=/home/jeanconn/git/starcheck
ska3-jeanconn-fido> mkdir -p mica_archive/starcheck
ska3-jeanconn-fido> cp /proj/sot/.snapshot/weekly.2024-01-21_0015/ska/data/mica/archive/starcheck/starcheck* mica_archive/starcheck/
ska3-jeanconn-fido> export MICA_ARCHIVE=/home/jeanconn/git/mica/mica_archive/
ska3-jeanconn-fido> python /proj/sot/ska3/flight/share/mica/update_starchecks.py 
Getting new starcheck.txt files from /data/mpcrit1/mplogs
Attempting ingest of /data/mpcrit1/mplogs/2024/JAN2224/oflsa/starcheck.txt
Attempting ingest of /data/mpcrit1/mplogs/2024/JAN2324/oflsb/starcheck.txt
Attempting ingest of /data/mpcrit1/mplogs/2024/JAN2324/oflsa/starcheck.txt
Attempting ingest of /data/mpcrit1/mplogs/2024/JAN2624/oflsa/starcheck.txt
Attempting ingest of /data/mpcrit1/mplogs/2024/JAN2924/oflsa/starcheck.txt
Attempting ingest of /data/mpcrit1/mplogs/2024/FEB0524/oflsa/starcheck.txt

I note that JAN2224A was already in the database with the 29217 obsid. The job finished without error and I rechecked 29217 (which also appeared in the JAN2324 and JAN2624 schedules).

sqlite> select obsid,slew_err_arcsec from starcheck_manvr  where obsid=29217;
29217|68.0
29217|
29217|
29217|
sqlite> select * from starcheck_manvr  where obsid=29217;
2532|29217|58|0|1766.0|82.94|68.0|0.00412132|-0.14894917|0.87225855|0.46579199|2024:028:22:01:12.278|15923778|2024:028:22:30:44
2533|29217|43|0|1766.0|82.94||0.00412132|-0.14894917|0.87225856|0.46579197|2024:028:22:01:12.278|15923778|2024:028:22:30:44
2534|29217|43|0|1766.0|82.94||0.00412132|-0.14894917|0.87225856|0.46579197|2024:028:22:01:12.278|15923778|2024:028:22:30:44
2535|29217|20|0|2060.0|105.0||-0.01619077|-0.18685837|0.86492329|0.46554217|2024:028:20:43:26.947|15905572|2024:028:21:17:52
sqlite> select sc_id,slew_err_arcsec from starcheck_manvr  where obsid=29217;
2532|68.0
2533|
2534|
2535|
sqlite> select * from starcheck_id where id = 2532;
2532|/2024/JAN2224/oflsa/|1705513689.59542
sqlite> select * from starcheck_id where id = 2533;
2533|/2024/JAN2324/oflsb/|1705969630.04826
sqlite> select * from starcheck_id where id = 2534;
2534|/2024/JAN2324/oflsa/|1705970179.81214
sqlite> select * from starcheck_id where id = 2535;
2535|/2024/JAN2624/oflsa/|1706221645.05288
jeanconn commented 6 months ago

Good catch on the starcheck.parser testing. I had done some to satisfy myself but forgot to document in the PR. I've updated the notes to describe what I did.