sot / starcheck

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

Get ACA planning and penalty limits from chandra_models #374

Closed taldcroft closed 3 years ago

taldcroft commented 3 years ago

Description

This uses the proseco.characteristics module to get the ACA planning and penalty limits from the latest release of chandra_models in $SKA/data/chandra_models.

This also includes an improvement to the exception handling for some Python functions that get called from perl.

Testing

Functional testing of planning limit

Used local dev version of proseco (https://github.com/sot/proseco/pull/356) @ f889746 along with a local version of chandra_models that has https://github.com/sot/chandra_models/pull/74 @ edcec9a. With this:

(ska3) ➜  starcheck git:(master) ✗ ./sandbox_starcheck -dir ~/ska/data/mpcrit1/mplogs/2021/JUN1421/oflsa
Using backstop file /Users/aldcroft/ska/data/mpcrit1/mplogs/2021/JUN1421/oflsa/CR165_0005.backstop
Using guide summary file /Users/aldcroft/ska/data/mpcrit1/mplogs/2021/JUN1421/oflsa/mps/mgJUN1421A.sum
Using OR file /Users/aldcroft/ska/data/mpcrit1/mplogs/2021/JUN1421/oflsa/mps/or/JUN1421_A.or
Using maneuver file /Users/aldcroft/ska/data/mpcrit1/mplogs/2021/JUN1421/oflsa/mps/mmJUN1421A.sum
Using DOT file /Users/aldcroft/ska/data/mpcrit1/mplogs/2021/JUN1421/oflsa/mps/mdJUN1421A.dot
Using mech check file /Users/aldcroft/ska/data/mpcrit1/mplogs/2021/JUN1421/oflsa/output/TEST_mechcheck.txt
Using fidsel file /Users/aldcroft/ska/data/mpcrit1/mplogs/2021/JUN1421/oflsa/History/FIDSEL.txt
Using dither file /Users/aldcroft/ska/data/mpcrit1/mplogs/2021/JUN1421/oflsa/History/DITHER.txt
Using radmon file /Users/aldcroft/ska/data/mpcrit1/mplogs/2021/JUN1421/oflsa/History/RADMON.txt
Using simtrans file /Users/aldcroft/ska/data/mpcrit1/mplogs/2021/JUN1421/oflsa/History/SIMTRANS.txt
Using simfocus file /Users/aldcroft/ska/data/mpcrit1/mplogs/2021/JUN1421/oflsa/History/SIMFOCUS.txt
Using attitude file /Users/aldcroft/ska/data/mpcrit1/mplogs/2021/JUN1421/oflsa/History/ATTITUDE.txt
Using characteristics file /Users/aldcroft/ska/data/mpcrit1/mplogs/2021/JUN1421/oflsa/mps/ode/characteristics/CHARACTERIS_18JAN21
Using aimpoint file /Users/aldcroft/ska/data/mpcrit1/mplogs/2021/JUN1421/oflsa/output/JUN1421A_dynamical_offsets.txt
Using config file /Users/aldcroft/git/starcheck/starcheck/data/characteristics.yaml
Using odb file /Users/aldcroft/git/starcheck/starcheck/data/fid_CHARACTERISTICS
Using agasc_file file /Users/aldcroft/ska/data/agasc/proseco_agasc_1p7.h5
Using manerr file /Users/aldcroft/ska/data/mpcrit1/mplogs/2021/JUN1421/oflsa/output/JUN1421A_ManErr.txt
Using processing summary file /Users/aldcroft/ska/data/mpcrit1/mplogs/2021/JUN1421/oflsa/mps/msJUN1421A.sum
Using TLR file /Users/aldcroft/ska/data/mpcrit1/mplogs/2021/JUN1421/oflsa/CR165_0005.tlr
Using banned_agasc file /Users/aldcroft/git/starcheck/starcheck/data/agasc.bad
Using bad_pixel file /Users/aldcroft/git/starcheck/starcheck/data/ACABadPixels
Using acq_star_rdb file /Users/aldcroft/git/starcheck/starcheck/data/bad_acq_stars.rdb
Using gui_star_rdb file /Users/aldcroft/git/starcheck/starcheck/data/bad_gui_stars.rdb
Read 246 ACA bad pixels from /Users/aldcroft/git/starcheck/starcheck/data/ACABadPixels
Read 46 bad AGASC IDs from /Users/aldcroft/git/starcheck/starcheck/data/agasc.bad
#####################################################################
# calc_ccd_temps run at Thu Jun 24 17:50:46 2021 by aldcroft
# Continuity run_start_time = 2021:175:21:50:46.268
# calc_ccd_temps version = 13.10.1.dev2+g0382316.d20210624
# kadi version = 5.6.0
#####################################################################

Using backstop file /Users/aldcroft/ska/data/mpcrit1/mplogs/2021/JUN1421/oflsa/CR165_0005.backstop
Found 1624 backstop commands between 2021:164:23:57:54.550 and 2021:172:05:35:12.589
RLTT = 2021:165:00:00:54.550
sched_stop = 2021:172:05:35:12.589
Fetching telemetry between 2021:163:23:57:54.550 and 2021:164:23:57:54.550
Calculating ACA thermal model
Propagation initial time and ACA: 2021:164:23:43:18.816 -9.13
Making temperature check plots
Writing plot file starcheck/ccd_temperature.png
Checking star catalog for obsid 46290
Checking star catalog for obsid 22518
Checking star catalog for obsid 46289
Checking star catalog for obsid 46288
Checking star catalog for obsid 46287
Checking star catalog for obsid 46286
Checking star catalog for obsid 46285
Checking star catalog for obsid 25062
Checking star catalog for obsid 25017
Checking star catalog for obsid 23612
Checking star catalog for obsid 25026
Checking star catalog for obsid 23410
Checking star catalog for obsid 24266
Checking star catalog for obsid 22980
Checking star catalog for obsid 24458
Checking star catalog for obsid 46284
Checking star catalog for obsid 46283
Checking star catalog for obsid 46282
Checking star catalog for obsid 46281
Checking star catalog for obsid 46280
Checking star catalog for obsid 46279
Checking star catalog for obsid 22519
Checking star catalog for obsid 23807
Checking star catalog for obsid 25041
Checking star catalog for obsid 24710
Checking star catalog for obsid 25063
Checking star catalog for obsid 46278
Checking star catalog for obsid 25050
Checking star catalog for obsid 23607
Checking star catalog for obsid 22450
Checking star catalog for obsid 25064
Checking star catalog for obsid 46277
Checking star catalog for obsid 46276
Checking star catalog for obsid 46275
Checking star catalog for obsid 46274
Checking star catalog for obsid 46273
Checking star catalog for obsid 46272
Checking star catalog for obsid 22594
Checking star catalog for obsid 23589
Checking star catalog for obsid 23563
Checking star catalog for obsid 23567
Checking star catalog for obsid 24732
Checking star catalog for obsid 22595
Wrote HTML report to starcheck.html
Wrote text report to starcheck.txt

The output shows the red and yellow limits lines at -5.8 and -6.8 C respectively, and shows expected INFO messages like >> INFO : Effective acq temperature -5.6 C.

Functional testing of exception handling

Modified one function that is wrapped in the new decorator to raise an exception (return 1 / 0) and confirmed the expected output and stop to processing.

taldcroft commented 3 years ago

Sorry about the whitespace changes. My editor just does that. When looking at the diffs you can click the settings icon and hide whitespace-only changes.

jeanconn commented 3 years ago

I like this. I was wondering if we'd want to put the characteristics fetching into chandra_aca or some such instead of proseco, but this seems fine.

taldcroft commented 3 years ago

I added another commit to just wrap every function in a decorator that does the right exception handling. This should really be a separate PR, but I messed up originally by bundling that first change in utils.py in one commit with the other stuff. Probably not worth the effort to clean that up.

jeanconn commented 3 years ago

Do we want to add the used version of chandra_models to some output? It isn't a critical element for starcheck, but we do have the stdout like

#####################################################################
# calc_ccd_temps run at Mon Jun 28 10:03:30 2021 by jeanconn
# Continuity run_start_time = 2021:179:14:03:30.276 
# calc_ccd_temps version = 13.10.1.dev4+g20f2e89
# kadi version = 5.6.0
#####################################################################
taldcroft commented 3 years ago

Adding the chandra_models version is a good idea will do.

jeanconn commented 3 years ago

I'll hold on final review until the version is in there (which I can also do?), but I've reviewed and played with this some more and I'm good with it.

jeanconn commented 3 years ago

I moved the import up to the top and passed it to the plotting routine. stdout log output now looks like

#####################################################################
# calc_ccd_temps run at Wed Jun 30 12:18:15 2021 by jeanconn
# Continuity run_start_time = 2021:181:16:18:15.029
# calc_ccd_temps version = 13.10.1.dev6+g96c4006
# chandra_models version = 3.35.1
# kadi version = 5.6.0
#####################################################################